Transform for matrix-based intra-prediction in image coding

ABSTRACT

An image coding method according to the present document comprises the steps of: deriving transform coefficients for a current block on the basis of residual-related information; and generating residual samples of the current block on the basis of the transform coefficients. The residual-related information comprises low frequency non-separable transform (LFNST) index information, showing information relating to non-separable transform for low-frequency transform coefficients of the current block, on the basis of a matrix-based intra-prediction (MIP) flag showing whether or not MIP is applied to the current block. The residual samples are generated from the transform coefficients on the basis of the LFNST index information.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No.PCT/KR2020/005076, filed on Apr. 16, 2020, which claims the benefit ofU.S. Provisional Application No. 62/834,946, filed on Apr. 16, 2019. Thedisclosures of the prior applications are incorporated by reference intheir entirety.

TECHNICAL FIELD

The present disclosure relates to an image coding technology, and moreparticularly, to a transform for matrix based intra prediction in imagecoding.

BACKGROUND

Recently, the demand for high resolution, high quality image/video suchas 4K, 8K or more Ultra High Definition (UHD) image/video is increasingin various fields. As the image/video resolution or quality becomeshigher, relatively more amount of information or bits are transmittedthan for conventional image/video data. Therefore, if image/video dataare transmitted via a medium such as an existing wired/wirelessbroadband line or stored in a legacy storage medium, costs fortransmission and storage are readily increased.

Moreover, interests and demand are growing for virtual reality (VR) andartificial reality (AR) contents, and immersive media such as hologram;and broadcasting of images/videos exhibiting image/video characteristicsdifferent from those of an actual image/video, such as gameimages/videos, are also growing.

Therefore, a highly efficient image/video compression technique isrequired to effectively compress and transmit, store, or play highresolution, high quality images/videos showing various characteristicsas described above.

SUMMARY

According to an embodiment of the present document, a method and anapparatus for enhancing image/video coding efficiency are provided.

According to an embodiment of the present document, a method and anapparatus for transforming a block to which matrix based intraprediction (MIP) is applied in image coding are provided.

According to an embodiment of the present document, a method and anapparatus for signaling a transform index for a block to which MIP isapplied are provided.

According to an embodiment of the present document, a method and anapparatus for signaling a transform index for a block to which MIP isnot applied are provided.

According to an embodiment of the present document, a method and anapparatus for inducing a transform index for a block to which MIP isapplied are provided.

According to an embodiment of the present document, a method and anapparatus for binarizing or coding a transform index for a block towhich MIP is applied are provided.

According to an embodiment of the present document, a video/imagedecoding method performed by a decoding apparatus is provided.

According to an embodiment of the present document, a decoding apparatusfor performing video/image decoding is provided.

According to an embodiment of the present document, a video/imageencoding method performed by an encoding apparatus is provided.

According to an embodiment of the present document, an encodingapparatus for performing video/image encoding is provided.

According to an embodiment of the present document, a computer-readabledigital storage medium storing encoded video/image information generatedaccording to the video/image encoding method disclosed in at least oneof the embodiments of this document is provided.

According to an embodiment of the present document, a computer-readabledigital storage medium storing encoded information or encodedvideo/image information causing a decoding apparatus to perform thevideo/image decoding method disclosed in at least one of the embodimentsof this document is provided.

According to the present document, the overall image/video compressionefficiency can be enhanced.

According to the present document, a transform index for a block towhich matrix based intra prediction (MIP) is applied can be efficientlysignaled.

According to the present document, a transform index for a block towhich MIP is applied can be efficiently coded.

According to the present document, a transform index for a block towhich MIP is applied can be induced without separately signaling thetransform index.

According to the present document, in case that MIP and low frequencynon-separable transform (LFNST) are all applied, interference betweenthem can be minimized, an optimum coding efficiency can be maintained,and complexity can be reduced.

Effects that can be obtained through a detailed example of the presentdocument are not limited to the effects enumerated above. For example,there may be various technical effects that can be understood or inducedby a person having ordinary skill in the related art from the presentdocument. Accordingly, the detailed effects of the present document arenot limited to those explicitly stated in the present document, but mayinclude various effects that can be understood or induced from thetechnical features of the present document.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 schematically illustrates an example of a video/image codingsystem to which the present document is applicable.

FIG. 2 is a diagram schematically explaining the configuration of avideo/image encoding apparatus to which the present document isapplicable.

FIG. 3 is a diagram schematically explaining the configuration of avideo/image decoding apparatus to which the present document isapplicable.

FIG. 4 schematically illustrates a multi-transform technique accordingto an embodiment of the present document.

FIG. 5 exemplarily illustrates intra directional modes in 65 predictiondirections.

FIGS. 6 and 7 are diagrams explaining RST according to an embodiment ofthe present document.

FIG. 8 exemplarily illustrates context-adaptive binary arithmetic coding(CABAC) for encoding syntax elements.

FIG. 9 is a diagram explaining MIP for an 8×8 block.

FIG. 10 is a flowchart explaining a method to which MIP and LFNST areapplied.

FIGS. 11 and 12 schematically illustrate a video/image encoding methodand an example of related components according to embodiment(s) of thepresent document.

FIGS. 13 and 14 schematically illustrate a video/image decoding methodand an example of related components according to embodiment(s) of thepresent document.

FIG. 15 illustrates an example of a content streaming system to whichembodiments disclosed in the present document are applicable.

DETAILED DESCRIPTION

The present disclosure may be modified in various forms, and specificembodiments thereof will be described and illustrated in the drawings.However, the embodiments are not intended for limiting the disclosure.The terms used in the following description are used to merely describespecific embodiments, but are not intended to limit the disclosure. Anexpression of a singular number includes an expression of the pluralnumber, so long as it is clearly read differently. The terms such as“include” and “have” are intended to indicate that features, numbers,steps, operations, elements, components, or combinations thereof used inthe following description exist and it should be thus understood thatthe possibility of existence or addition of one or more differentfeatures, numbers, steps, operations, elements, components, orcombinations thereof is not excluded.

In addition, each configuration of the drawings described in thisdocument is an independent illustration for explaining functions asfeatures that are different from each other, and does not mean that eachconfiguration is implemented by mutually different hardware or differentsoftware. For example, two or more of the configurations can be combinedto form one configuration, and one configuration can also be dividedinto multiple configurations. Without departing from the gist of thisdocument, embodiments in which configurations are combined and/orseparated are included in the scope of claims.

Hereinafter, examples of the present embodiment will be described indetail with reference to the accompanying drawings. In addition, likereference numerals are used to indicate like elements throughout thedrawings, and the same descriptions on the like elements will beomitted.

This document relates to video/image coding. For example,methods/embodiments disclosed in this document may be related to theversatile video coding (VVC) standard (ITU-T Rec. H.266), thenext-generation video/image coding standard after VVC, or other videocoding related standards (e.g., high efficiency video coding (HEVC)standard (ITU-T Rec. H.265), essential video coding (EVC) standard, AVS2standard, and the like).

This document suggests various embodiments of video/image coding, andthe above embodiments may also be performed in combination with eachother unless otherwise specified.

In this document, a video may refer to a series of images over time. Apicture generally refers to the unit representing one image at aparticular time frame, and a slice/tile refers to the unit constitutinga part of the picture in terms of coding. A slice/tile may include oneor more coding tree units (CTUs). One picture may consist of one or moreslices/tiles. One picture may consist of one or more tile groups. Onetile group may include one or more tiles.

A pixel or a pel may mean a smallest unit constituting one picture (orimage). Also, ‘sample’ may be used as a term corresponding to a pixel. Asample may generally represent a pixel or a value of a pixel, and mayrepresent only a pixel/pixel value of a luma component or only apixel/pixel value of a chroma component.

A unit may represent a basic unit of image processing. The unit mayinclude at least one of a specific region of the picture and informationrelated to the region. One unit may include one luma block and twochroma (ex. cb, cr) blocks. The unit may be used interchangeably withterms such as block or area in some cases. In a general case, an M×Nblock may include samples (or sample arrays) or a set (or array) oftransform coefficients of M columns and N rows. Alternatively, thesample may mean a pixel value in the spatial domain, and when such apixel value is transformed to the frequency domain, it may mean atransform coefficient in the frequency domain.

In this document, the term “I” and “,” should be interpreted to indicate“and/or.” For instance, the expression “A/B” may mean “A and/or B.”Further, “A, B” may mean “A and/or B.” Further, “A/B/C” may mean “atleast one of A, B, and/or C.” Also, “A/B/C” may mean “at least one of A,B, and/or C.”

Further, in the document, the term “or” should be interpreted toindicate “and/or.” For instance, the expression “A or B” may comprise 1)only A, 2) only B, and/or 3) both A and B. In other words, the term “or”in this document should be interpreted to indicate “additionally oralternatively.”

In the present specification, “at least one of A and B” may mean “onlyA”, “only B”, or “both A and B”. Further, in the present specification,the expression “at least one of A or B” or “at least one of A and/or B”may be interpreted the same as “at least one of A and B”.

Further, in the present specification, “at least one of A, B and C” maymean “only A”, “only B”, “only C”, or “any combination of A, B and C”.Further, “at least one of A, B or C” or “at least one of A, B and/or C”may mean “at least one of A, B and C”.

Further, the parentheses used in the present specification may mean “forexample”. Specifically, in the case that “prediction (intra prediction)”is expressed, it may be indicated that “intra prediction” is proposed asan example of “prediction”. In other words, the term “prediction” in thepresent specification is not limited to “intra prediction”, and it maybe indicated that “intra prediction” is proposed as an example of“prediction”. Further, even in the case that “prediction (i.e., intraprediction)” is expressed, it may be indicated that “intra prediction”is proposed as an example of “prediction”.

In the present specification, technical features individually explainedin one drawing may be individually implemented, or may be simultaneouslyimplemented.

FIG. 1 illustrates an example of a video/image coding system to whichthe disclosure of the present document may be applied.

Referring to FIG. 1 , a video/image coding system may include a sourcedevice and a reception device. The source device may transmit encodedvideo/image information or data to the reception device through adigital storage medium or network in the form of a file or streaming.

The source device may include a video source, an encoding apparatus, anda transmitter. The receiving device may include a receiver, a decodingapparatus, and a renderer. The encoding apparatus may be called avideo/image encoding apparatus, and the decoding apparatus may be calleda video/image decoding apparatus. The transmitter may be included in theencoding apparatus. The receiver may be included in the decodingapparatus. The renderer may include a display, and the display may beconfigured as a separate device or an external component.

The video source may acquire video/image through a process of capturing,synthesizing, or generating the video/image. The video source mayinclude a video/image capture device and/or a video/image generatingdevice. The video/image capture device may include, for example, one ormore cameras, video/image archives including previously capturedvideo/images, and the like. The video/image generating device mayinclude, for example, computers, tablets and smartphones, and may(electronically) generate video/images. For example, a virtualvideo/image may be generated through a computer or the like. In thiscase, the video/image capturing process may be replaced by a process ofgenerating related data.

The encoding apparatus may encode input video/image. The encodingapparatus may perform a series of procedures such as prediction,transform, and quantization for compaction and coding efficiency. Theencoded data (encoded video/image information) may be output in the formof a bitstream.

The transmitter may transmit the encoded image/image information or dataoutput in the form of a bitstream to the receiver of the receivingdevice through a digital storage medium or a network in the form of afile or streaming. The digital storage medium may include variousstorage mediums such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, and thelike. The transmitter may include an element for generating a media filethrough a predetermined file format and may include an element fortransmission through a broadcast/communication network. The receiver mayreceive/extract the bitstream and transmit the received bitstream to thedecoding apparatus.

The decoding apparatus may decode the video/image by performing a seriesof procedures such as dequantization, inverse transform, and predictioncorresponding to the operation of the encoding apparatus.

The renderer may render the decoded video/image. The renderedvideo/image may be displayed through the display.

FIG. 2 is a diagram schematically illustrating the configuration of avideo/image encoding apparatus to which the disclosure of the presentdocument may be applied. Hereinafter, what is referred to as the videoencoding apparatus may include an image encoding apparatus.

Referring to FIG. 2 , the encoding apparatus 200 may include and beconfigured with an image partitioner 210, a predictor 220, a residualprocessor 230, an entropy encoder 240, an adder 250, a filter 260, and amemory 270. The predictor 220 may include an inter predictor 221 and anintra predictor 222. The residual processor 230 may include atransformer 232, a quantizer 233, a dequantizer 234, and an inversetransformer 235. The residual processor 230 may further include asubtractor 231. The adder 250 may be called a reconstructor orreconstructed block generator. The image partitioner 210, the predictor220, the residual processor 230, the entropy encoder 240, the adder 250,and the filter 260, which have been described above, may be configuredby one or more hardware components (e.g., encoder chipsets orprocessors) according to an embodiment. In addition, the memory 270 mayinclude a decoded picture buffer (DPB), and may also be configured by adigital storage medium. The hardware component may further include thememory 270 as an internal/external component.

The image partitioner 210 may split an input image (or, picture, frame)input to the encoding apparatus 200 into one or more processing units.As an example, the processing unit may be called a coding unit (CU). Inthis case, the coding unit may be recursively split according to aQuad-tree binary-tree ternary-tree (QTBTTT) structure from a coding treeunit (CTU) or the largest coding unit (LCU). For example, one codingunit may be split into a plurality of coding units of a deeper depthbased on a quad-tree structure, a binary-tree structure, and/or aternary-tree structure. In this case, for example, the quad-treestructure is first applied and the binary-tree structure and/or theternary-tree structure may be later applied. Alternatively, thebinary-tree structure may also be first applied. A coding procedureaccording to the present disclosure may be performed based on a finalcoding unit which is not split any more. In this case, based on codingefficiency according to image characteristics or the like, the maximumcoding unit may be directly used as the final coding unit, or asnecessary, the coding unit may be recursively split into coding units ofa deeper depth, such that a coding unit having an optimal size may beused as the final coding unit. Here, the coding procedure may include aprocedure such as prediction, transform, and reconstruction to bedescribed later. As another example, the processing unit may furtherinclude a prediction unit (PU) or a transform unit (TU). In this case,each of the prediction unit and the transform unit may be split orpartitioned from the aforementioned final coding unit. The predictionunit may be a unit of sample prediction, and the transform unit may be aunit for inducing a transform coefficient and/or a unit for inducing aresidual signal from the transform coefficient.

The unit may be interchangeably used with the term such as a block or anarea in some cases. Generally, an M×N block may represent samplescomposed of M columns and N rows or a group of transform coefficients.The sample may generally represent a pixel or a value of the pixel, andmay also represent only the pixel/pixel value of a luma component, andalso represent only the pixel/pixel value of a chroma component. Thesample may be used as the term corresponding to a pixel or a pelconfiguring one picture (or image).

The subtractor 231 may generate a residual signal (residual block,residual samples, or residual sample array) by subtracting a predictionsignal (predicted block, prediction samples, or prediction sample array)output from the predictor 220 from an input image signal (originalblock, original samples, or original sample array), and the generatedresidual signal is transmitted to the transformer 232. The predictor 220may perform prediction for a processing target block (hereinafter,referred to as a “current block”), and generate a predicted blockincluding prediction samples for the current block. The predictor 220may determine whether intra prediction or inter prediction is applied ona current block or in a CU unit. As described later in the descriptionof each prediction mode, the predictor may generate various kinds ofinformation related to prediction, such as prediction mode information,and transfer the generated information to the entropy encoder 240. Theinformation on the prediction may be encoded in the entropy encoder 240and output in the form of a bitstream.

The intra predictor 222 may predict a current block with reference tosamples within a current picture. The referenced samples may be locatedneighboring to the current block, or may also be located away from thecurrent block according to the prediction mode. The prediction modes inthe intra prediction may include a plurality of non-directional modesand a plurality of directional modes. The non-directional mode mayinclude, for example, a DC mode or a planar mode. The directional modemay include, for example, 33 directional prediction modes or 65directional prediction modes according to the fine degree of theprediction direction. However, this is illustrative and the directionalprediction modes which are more or less than the above number may beused according to the setting. The intra predictor 222 may alsodetermine the prediction mode applied to the current block using theprediction mode applied to the neighboring block.

The inter predictor 221 may induce a predicted block of the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. At this time, in order to decreasethe amount of motion information transmitted in the inter predictionmode, the motion information may be predicted in units of a block, asub-block, or a sample based on the correlation of the motioninformation between the neighboring block and the current block. Themotion information may include a motion vector and a reference pictureindex. The motion information may further include inter predictiondirection (L0 prediction, L1 prediction, Bi prediction, or the like)information. In the case of the inter prediction, the neighboring blockmay include a spatial neighboring block existing within the currentpicture and a temporal neighboring block existing in the referencepicture. The reference picture including the reference block and thereference picture including the temporal neighboring block may also bethe same as each other, and may also be different from each other. Thetemporal neighboring block may be called the name such as a collocatedreference block, a collocated CU (colCU), or the like, and the referencepicture including the temporal neighboring block may also be called acollocated picture (colPic). For example, the inter predictor 221 mayconfigure a motion information candidate list based on the neighboringblocks, and generate information indicating what candidate is used toderive the motion vector and/or the reference picture index of thecurrent block. The inter prediction may be performed based on variousprediction modes, and for example, in the case of a skip mode and amerge mode, the inter predictor 221 may use the motion information ofthe neighboring block as the motion information of the current block. Inthe case of the skip mode, the residual signal may not be transmittedunlike the merge mode. A motion vector prediction (MVP) mode mayindicate the motion vector of the current block by using the motionvector of the neighboring block as a motion vector predictor, andsignaling a motion vector difference.

The predictor 220 may generate a prediction signal based on variousprediction methods described below. For example, the predictor may notonly apply intra prediction or inter prediction to predict one block butalso simultaneously apply both intra prediction and inter prediction.This may be called combined inter and intra prediction (CUP). Inaddition, the predictor may perform an intra block copy (IBC) forprediction of a block. The intra block copy may be used for contentimage/moving image coding of a game or the like, for example, screencontent coding (SCC). The IBC basically performs prediction in thecurrent picture, but may be performed similarly to inter prediction inthat a reference block is derived in the current picture. That is, theIBC may use at least one of inter prediction techniques described in thepresent document.

The prediction signal generated through the inter predictor 221 and/orthe intra predictor 222 may be used to generate a reconstructed signalor to generate a residual signal. The transformer 232 may generatetransform coefficients by applying a transform technique to the residualsignal. For example, the transform technique may include at least one ofa discrete cosine transform (DCT), a discrete sine transform (DST), agraph-based transform (GBT), or a conditionally non-linear transform(CNT). Here, the GBT means transform obtained from a graph whenrelationship information between pixels is represented by the graph. TheCNT refers to the transform obtained based on a prediction signalgenerated using all previously reconstructed pixels. In addition, thetransform process may be applied to square pixel blocks having the samesize, or may be applied to blocks having a variable size rather than asquare.

The quantizer 233 may quantize the transform coefficients and transmitthem to the entropy encoder 240, and the entropy encoder 240 may encodethe quantized signal (information on the quantized transformcoefficients) and output a bitstream. The information on the quantizedtransform coefficients may be referred to as residual information. Thequantizer 233 may rearrange block type quantized transform coefficientsinto a one-dimensional vector form based on a coefficient scanningorder, and generate information on the quantized transform coefficientsbased on the quantized transform coefficients in the one-dimensionalvector form. The entropy encoder 240 may perform various encodingmethods such as, for example, exponential Golomb, context-adaptivevariable length coding (CAVLC), context-adaptive binary arithmeticcoding (CABAC), and the like. The entropy encoder 240 may encodeinformation necessary for video/image reconstruction together with orseparately from the quantized transform coefficients (e.g., values ofsyntax elements and the like). Encoded information (e.g., encodedvideo/image information) may be transmitted or stored in the unit of anetwork abstraction layer (NAL) in the form of a bitstream. Thevideo/image information may further include information on variousparameter sets, such as an adaptation parameter set (APS), a pictureparameter set (PPS), a sequence parameter set (SPS), or a videoparameter set (VPS). In addition, the video/image information mayfurther include general constraint information. In the present document,information and/or syntax elements being signaled/transmitted to bedescribed later may be encoded through the above-described encodingprocedure, and be included in the bitstream. The bitstream may betransmitted through a network, or may be stored in a digital storagemedium. Here, the network may include a broadcasting network and/or acommunication network, and the digital storage medium may includevarious storage media, such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, andthe like. A transmitter (not illustrated) transmitting a signal outputfrom the entropy encoder 240 and/or a storage unit (not illustrated)storing the signal may be configured as an internal/external element ofthe encoding apparatus 200, and alternatively, the transmitter may beincluded in the entropy encoder 240.

The quantized transform coefficients output from the quantizer 233 maybe used to generate a prediction signal. For example, the residualsignal (residual block or residual samples) may be reconstructed byapplying dequantization and inverse transform to the quantized transformcoefficients through the dequantizer 234 and the inverse transformer235. The adder 250 adds the reconstructed residual signal to theprediction signal output from the predictor 220 to generate areconstructed signal (reconstructed picture, reconstructed block,reconstructed samples, or reconstructed sample array). If there is noresidual for the processing target block, such as a case that a skipmode is applied, the predicted block may be used as the reconstructedblock. The generated reconstructed signal may be used for intraprediction of a next processing target block in the current picture, andmay be used for inter prediction of a next picture through filtering asdescribed below.

Meanwhile, luma mapping with chroma scaling (LMCS) may be applied duringa picture encoding and/or reconstruction process.

The filter 260 may improve subjective/objective image quality byapplying filtering to the reconstructed signal. For example, the filter260 may generate a modified reconstructed picture by applying variousfiltering methods to the reconstructed picture, and store the modifiedreconstructed picture in the memory 270, specifically, in a DPB of thememory 270. The various filtering methods may include, for example,deblocking filtering, a sample adaptive offset (SAO), an adaptive loopfilter, a bilateral filter, and the like. The filter 260 may generatevarious kinds of information related to the filtering, and transfer thegenerated information to the entropy encoder 290 as described later inthe description of each filtering method. The information related to thefiltering may be encoded by the entropy encoder 290 and output in theform of a bitstream.

The modified reconstructed picture transmitted to the memory 270 may beused as a reference picture in the inter predictor 221. When the interprediction is applied through the encoding apparatus, predictionmismatch between the encoding apparatus 200 and the decoding apparatuscan be avoided and encoding efficiency can be improved.

The DPB of the memory 270 may store the modified reconstructed picturefor use as the reference picture in the inter predictor 221. The memory270 may store motion information of a block from which the motioninformation in the current picture is derived (or encoded) and/or motioninformation of blocks in the picture, having already been reconstructed.The stored motion information may be transferred to the inter predictor221 to be utilized as motion information of the spatial neighboringblock or motion information of the temporal neighboring block. Thememory 270 may store reconstructed samples of reconstructed blocks inthe current picture, and may transfer the reconstructed samples to theintra predictor 222.

FIG. 3 is a diagram for schematically explaining the configuration of avideo/image decoding apparatus to which the disclosure of the presentdocument may be applied.

Referring to FIG. 3 , the decoding apparatus 300 may include andconfigured with an entropy decoder 310, a residual processor 320, apredictor 330, an adder 340, a filter 350, and a memory 360. Thepredictor 330 may include an inter predictor 331 and an intra predictor332. The residual processor 320 may include a dequantizer 321 and aninverse transformer 322. The entropy decoder 310, the residual processor320, the predictor 330, the adder 340, and the filter 350, which havebeen described above, may be configured by one or more hardwarecomponents (e.g., decoder chipsets or processors) according to anembodiment. Further, the memory 360 may include a decoded picture buffer(DPB), and may be configured by a digital storage medium. The hardwarecomponent may further include the memory 360 as an internal/externalcomponent.

When the bitstream including the video/image information is input, thedecoding apparatus 300 may reconstruct the image in response to aprocess in which the video/image information is processed in theencoding apparatus illustrated in FIG. 2 . For example, the decodingapparatus 300 may derive the units/blocks based on block split-relatedinformation acquired from the bitstream. The decoding apparatus 300 mayperform decoding using the processing unit applied to the encodingapparatus. Therefore, the processing unit for the decoding may be, forexample, a coding unit, and the coding unit may be split according tothe quad-tree structure, the binary-tree structure, and/or theternary-tree structure from the coding tree unit or the maximum codingunit. One or more transform units may be derived from the coding unit.In addition, the reconstructed image signal decoded and output throughthe decoding apparatus 300 may be reproduced through a reproducingapparatus.

The decoding apparatus 300 may receive a signal output from the encodingapparatus of FIG. 2 in the form of a bitstream, and the received signalmay be decoded through the entropy decoder 310. For example, the entropydecoder 310 may parse the bitstream to derive information (e.g.,video/image information) necessary for image reconstruction (or picturereconstruction). The video/image information may further includeinformation on various parameter sets such as an adaptation parameterset (APS), a picture parameter set (PPS), a sequence parameter set(SPS), or a video parameter set (VPS). In addition, the video/imageinformation may further include general constraint information. Thedecoding apparatus may further decode picture based on the informationon the parameter set and/or the general constraint information.Signaled/received information and/or syntax elements described later inthis document may be decoded may decode the decoding procedure andobtained from the bitstream. For example, the entropy decoder 310decodes the information in the bitstream based on a coding method suchas exponential Golomb coding, CAVLC, or CABAC, and output syntaxelements required for image reconstruction and quantized values oftransform coefficients for residual. More specifically, the CABACentropy decoding method may receive a bin corresponding to each syntaxelement in the bitstream, determine a context model by using a decodingtarget syntax element information, decoding information of a decodingtarget block or information of a symbol/bin decoded in a previous stage,and perform an arithmetic decoding on the bin by predicting aprobability of occurrence of a bin according to the determined contextmodel, and generate a symbol corresponding to the value of each syntaxelement. In this case, the CABAC entropy decoding method may update thecontext model by using the information of the decoded symbol/bin for acontext model of a next symbol/bin after determining the context model.The information related to the prediction among the information decodedby the entropy decoder 310 may be provided to the predictor 330, andinformation on the residual on which the entropy decoding has beenperformed in the entropy decoder 310, that is, the quantized transformcoefficients and related parameter information, may be input to thedequantizer 321. In addition, information on filtering among informationdecoded by the entropy decoder 310 may be provided to the filter 350.Meanwhile, a receiver (not illustrated) for receiving a signal outputfrom the encoding apparatus may be further configured as aninternal/external element of the decoding apparatus 300, or the receivermay be a constituent element of the entropy decoder 310. Meanwhile, thedecoding apparatus according to the present document may be referred toas a video/image/picture decoding apparatus, and the decoding apparatusmay be classified into an information decoder (video/image/pictureinformation decoder) and a sample decoder (video/image/picture sampledecoder). The information decoder may include the entropy decoder 310,and the sample decoder may include at least one of the dequantizer 321,the inverse transformer 322, the predictor 330, the adder 340, thefilter 350, and the memory 360.

The dequantizer 321 may dequantize the quantized transform coefficientsto output the transform coefficients. The dequantizer 321 may rearrangethe quantized transform coefficients in a two-dimensional block form. Inthis case, the rearrangement may be performed based on a coefficientscan order performed by the encoding apparatus. The dequantizer 321 mayperform dequantization for the quantized transform coefficients using aquantization parameter (e.g., quantization step size information), andacquire the transform coefficients.

The inverse transformer 322 inversely transforms the transformcoefficients to acquire the residual signal (residual block, residualsample array).

The predictor 330 may perform the prediction of the current block, andgenerate a predicted block including the prediction samples of thecurrent block. The predictor may determine whether the intra predictionis applied or the inter prediction is applied to the current block basedon the information about prediction output from the entropy decoder 310,and determine a specific intra/inter prediction mode.

The predictor may generate a prediction signal based on variousprediction methods described below. For example, the predictor may notonly apply intra prediction or inter prediction to predict one block butalso simultaneously apply intra prediction and inter prediction. Thismay be called combined inter and intra prediction (CIIP). In addition,the predictor may perform an intra block copy (IBC) for prediction of ablock. The intra block copy may be used for content image/moving imagecoding of a game or the like, for example, screen content coding (SCC).The IBC basically performs prediction in the current picture, but may beperformed similarly to inter prediction in that a reference block isderived in the current picture. That is, the IBC may use at least one ofinter prediction techniques described in the present document.

The intra predictor 332 may predict the current block by referring tothe samples in the current picture. The referred samples may be locatedin the neighborhood of the current block, or may be located apart fromthe current block according to the prediction mode. In intra prediction,prediction modes may include a plurality of non-directional modes and aplurality of directional modes. The intra predictor 332 may determinethe prediction mode to be applied to the current block by using theprediction mode applied to the neighboring block.

The inter predictor 331 may derive a predicted block for the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. In this case, in order to reducethe amount of motion information being transmitted in the interprediction mode, motion information may be predicted in the unit ofblocks, subblocks, or samples based on correlation of motion informationbetween the neighboring block and the current block. The motioninformation may include a motion vector and a reference picture index.The motion information may further include information on interprediction direction (L0 prediction, L1 prediction, Bi prediction, andthe like). In case of inter prediction, the neighboring block mayinclude a spatial neighboring block existing in the current picture anda temporal neighboring block existing in the reference picture. Forexample, the inter predictor 331 may construct a motion informationcandidate list based on neighboring blocks, and derive a motion vectorof the current block and/or a reference picture index based on thereceived candidate selection information. Inter prediction may beperformed based on various prediction modes, and the information on theprediction may include information indicating a mode of inter predictionfor the current block.

The adder 340 may generate a reconstructed signal (reconstructedpicture, reconstructed block, or reconstructed sample array) by addingthe obtained residual signal to the prediction signal (predicted blockor predicted sample array) output from the predictor 330. If there is noresidual for the processing target block, such as a case that a skipmode is applied, the predicted block may be used as the reconstructedblock.

The adder 340 may be called a reconstructor or a reconstructed blockgenerator. The generated reconstructed signal may be used for the intraprediction of a next block to be processed in the current picture, andas described later, may also be output through filtering or may also beused for the inter prediction of a next picture.

Meanwhile, a luma mapping with chroma scaling (LMCS) may also be appliedin the picture decoding process.

The filter 350 may improve subjective/objective image quality byapplying filtering to the reconstructed signal. For example, the filter350 may generate a modified reconstructed picture by applying variousfiltering methods to the reconstructed picture, and store the modifiedreconstructed picture in the memory 360, specifically, in a DPB of thememory 360. The various filtering methods may include, for example,deblocking filtering, a sample adaptive offset, an adaptive loop filter,a bilateral filter, and the like.

The (modified) reconstructed picture stored in the DPB of the memory 360may be used as a reference picture in the inter predictor 331. Thememory 360 may store the motion information of the block from which themotion information in the current picture is derived (or decoded) and/orthe motion information of the blocks in the picture having already beenreconstructed. The stored motion information may be transferred to theinter predictor 331 so as to be utilized as the motion information ofthe spatial neighboring block or the motion information of the temporalneighboring block. The memory 360 may store reconstructed samples ofreconstructed blocks in the current picture, and transfer thereconstructed samples to the intra predictor 332.

In the present specification, the embodiments described in the predictor330, the dequantizer 321, the inverse transformer 322, and the filter350 of the decoding apparatus 300 may also be applied in the same manneror corresponding to the predictor 220, the dequantizer 234, the inversetransformer 235, and the filter 260 of the encoding apparatus 200.

Meanwhile, as described above, in performing video coding, prediction isperformed to improve compression efficiency. Through this, a predictedblock including prediction samples for a current block as a block to becoded (i.e., a coding target block) may be generated. Here, thepredicted block includes prediction samples in a spatial domain (orpixel domain). The predicted block is derived in the same manner in anencoding apparatus and a decoding apparatus, and the encoding apparatusmay signal information (residual information) on residual between theoriginal block and the predicted block, rather than an original samplevalue of an original block, to the decoding apparatus, therebyincreasing image coding efficiency. The decoding apparatus may derive aresidual block including residual samples based on the residualinformation, add the residual block and the predicted block to generatereconstructed blocks including reconstructed samples, and generate areconstructed picture including the reconstructed blocks.

The residual information may be generated through a transform andquantization procedure. For example, the encoding apparatus may derive aresidual block between the original block and the predicted block,perform a transform procedure on residual samples (residual samplearray) included in the residual block to derive transform coefficients,perform a quantization procedure on the transform coefficients to derivequantized transform coefficients, and signal related residualinformation to the decoding apparatus (through a bit stream). Here, theresidual information may include value information of the quantizedtransform coefficients, location information, a transform technique, atransform kernel, a quantization parameter, and the like. The decodingapparatus may perform dequantization/inverse transform procedure basedon the residual information and derive residual samples (or residualblocks). The decoding apparatus may generate a reconstructed picturebased on the predicted block and the residual block. Also, for referencefor inter prediction of a picture afterward, the encoding apparatus mayalso dequantize/inverse-transform the quantized transform coefficientsto derive a residual block and generate a reconstructed picture basedthereon.

FIG. 4 schematically illustrates a multi-transform technique accordingto the present document.

Referring to FIG. 4 , a transformer may correspond to the transformer inthe encoding apparatus of FIG. 2 as described above, and an inversetransformer may correspond to the inverse transformer in the encodingapparatus of FIG. 2 , or the inverse transformer in the decodingapparatus of FIG. 3 as described above.

The transformer may derive (primary) transform coefficients byperforming primary transform based on residual sample (residual samplearray) in a residual block (S410). Such primary transform may bereferred to as a core transform. Here, the primary transform may bebased on multiple transform selection (MTS), and in case that themulti-transform is applied as the primary transform, it may be referredto as multi core transform.

For example, the multi core transform may represent a transform methodby additionally using discrete cosine transform (DCT) type 2 (DCT-II),discrete sine transform (DST) type 7 (DST-VII), DCT type 8 (DCT-VIII),and/or DST type 1 (DST-I). That is, the multi core transform mayrepresent a transform method for transforming a residual signal (orresidual block) of a spatial domain into transform coefficients (orprimary transform coefficients) of a frequency domain based on aplurality of transform kernels selected among the DCT type 2, the DSTtype 7, the DCT type 8, and the DST type 1. Here, the primary transformcoefficients may be called temporary transform coefficients on thetransformer side.

In other words, in case that the existing transform method is applied,transform of the spatial domain for the residual signal (or residualblock) into the frequency domain may be applied based on the DCT type 2,and the transform coefficients may be generated. However, unlike this,in case that the multi core transform is applied, transform of thespatial domain for the residual signal (or residual block) into thefrequency domain may be applied based on the DCT type 2, DST type 7, DCTtype 8, and/or DST type 1, and the transform coefficients (or primarytransform coefficients) may be generated. Here, the DCT type 2, DST type7, DCT type 8, and DST type 1 may be called the transform type,transform kernel, or transform core. The DCT/DST transform types may bedefined based on basis functions.

In case that the multi core transform is performed, a vertical transformkernel and/or a horizontal transform kernel for a target block may beselected among the transform kernels, a vertical transform for thetarget block may be performed based on the vertical transform kernel,and a horizontal transform for the target block may be performed basedon the horizontal transform kernel. Here, the horizontal transform mayrepresent a transform for horizontal components of the target block, andthe vertical transform may represent a transform for vertical componentsof the target block. The vertical transform kernel/horizontal transformkernel may be adaptively determined based on the prediction mode and/ortransform index of the target block (CU or subblock) including theresidual block.

Further, for example, in case of performing primary transform byapplying MTS, specific basis functions may be configured to specifiedvalues, and in case of the vertical transform or horizontal transform,the mapping relationship for the transform kernel may be configured bycombining what basis functions are applied. For example, in case thatthe horizontal direction transform kernel is represented by trTypeHor,and the vertical direction transform kernel is represented by trTypeVer,the trTypeHor or trTypeVer having a value of 0 may be configured asDCT2, and the trTypeHor or trTypeVer having a value of 1 may beconfigured as DCT7. The trTypeHor or trTypeVer having a value of 2 maybe configured as DCT8.

Further, for example, in order to indicate any one of plural transformkernel sets, an MTS index may be encoded, and MTS index information maybe signaled to the decoding apparatus. Here, the MTS index may berepresented as tu_mts_idx syntax element or mts_idx syntax element. Forexample, if the MTS index is 0, it may represent that values oftrTypeHor and trTypeVer are all 0, and if the MTS index is 1, it mayrepresent that the values of trTypeHor and trTypeVer are all 1. If theMTS index is 2, it may represent that the value of trTypeHor is 2 andthe value of trTypeVer is 1, and if the MTS index is 3, it may representthat the value of trTypeHor is 1 and the value of trTypeVer is 2. If theMTS index is 4, it may represent that the values of trTypeHor andtrTypeVer are all 2. For example, a transform kernel set according tothe MTS index may be represented as in the following table.

TABLE 1 MTS index 0 1 2 3 4 trTypeHor 0 1 2 1 2 trTypeVer 0 1 1 2 2

The transformer may derive modified (secondary) transform coefficientsby performing secondary transform based on the (primary) transformcoefficients (S420). The primary transform may be a transform of thespatial domain into the frequency domain, and the secondary transformmay represent a transform into a more compressive expression by using acorrelation existing between the (primary) transform coefficients.

For example, the secondary transform may include a non-separabletransform. In this case, the secondary transform may be called anon-separable secondary transform (NSST) or a mode-dependentnon-separable secondary transform (MDNSST). The non-separable secondarytransform may represent a transform for generating modified transformcoefficients (or secondary transform coefficients) for the residualsignal by secondarily transforming the (primary) transform coefficientsderived through the primary transform based on a non-separable transformmatrix. Here, the vertical transform and the horizontal transform maynot be separately (or independently) applied with respect to the(primary) transform coefficients based on the non-separable transformmatrix, but may be applied all at once.

In other words, the non-separable secondary transform may represent atransform method for rearranging, for example, two-dimensional signals(transform coefficients) to one-dimensional signal through aspecifically determined direction (e.g., row-first direction orcolumn-first direction), without separating the (primary) transformcoefficients into vertical components and horizontal components, andthen generating modified transform coefficients (or secondary transformcoefficients) based on the non-separable transform matrix.

For example, the row-first direction (or order) may represent anarrangement of an M×N block in a line in the order of a first row to anN-th row, and the column-first direction (or order) may represent anarrangement of an M×N block in a line in the order of a first column toan M-th column. Here, M and N may represent a width (W) and a height (H)of the block, and may be all positive integers.

For example, the non-separable secondary transform may be applied to atop-left area of the block composed of (primary) transform coefficients(hereinafter, transform coefficient block). For example, if the width(W) and the height (1-1) of the transform coefficient block are allequal to or larger than 8, 8×8 non-separable secondary transform may beapplied to the top-left 8×8 area of the transform coefficient block.Further, if the width (W) and the height (H) of the transformcoefficient block are all equal to or larger than 4 and smaller than 8,4×4 non-separable secondary transform may be applied to the top-left min(8, W)×min (8, H) area of the transform coefficient block. However,embodiments are not limited thereto, and for example, even if acondition that the width (W) and the height (H) of the transformcoefficient block are all equal to or larger than 4 is satisfied, the4×4 non-separable secondary transform may be applied to the top-left min(8, W)×min (8, H) area of the transform coefficient block.

Specifically, for example, in case that a 4×4 input block is used, thenon-separable secondary transform may be performed as follows.

The 4×4 input block X may be represented as follows.

$\begin{matrix}{X = \begin{bmatrix}X_{00} & X_{01} & X_{02} & X_{03} \\X_{10} & X_{11} & X_{12} & X_{13} \\X_{20} & X_{21} & X_{22} & X_{23} \\X_{30} & X_{31} & X_{32} & X_{33}\end{bmatrix}} & {{Equation}\mspace{14mu} 1}\end{matrix}$

For example, the vector form of the X may be represented as follows.{right arrow over (X)}=[X ₀₀ X ₀₁ X ₀₂ X ₀₃ X ₁₀ X ₁₁ X ₁₂ X ₁₃ X ₂₀ X₂₁ X ₂₂ X ₂₃ X ₃₀ X ₃₁ X ₃₂ X ₃₃]^(T)  [Equation 2]

Referring to Equation 2, {right arrow over (X)} may represent the vectorX, and the two-dimensional block of the X in Equation 1 may berearranged and represented as the one-dimensional vector in accordancewith the row-first order.

In this case, the secondary non-separable transform may be calculated asfollows.{right arrow over (F)}=T·{right arrow over (X)}  [Equation 3]

Here, {right arrow over (F)} may represent a transform coefficientvector, and T may represent 16×16 (non-separable) transform matrix.

Based on Equation 3, {right arrow over (F)} having a size of 16×1 may bederived, and {right arrow over (F)} may be reorganized as 4×4 blockthrough a scan order (horizontal, vertical, or diagonal). However, theabove-described calculation is exemplary, and in order to reducecalculation complexity of the non-separable secondary transform,hypercube-givens transform (HyGT) and the like may be used to calculatethe non-separable secondary transform.

Meanwhile, in the non-separable secondary transform, a transform kernel(or transform core or transform type) may be selected in a modedependent manner. Here, the mode may include an intra prediction modeand/or an inter prediction mode.

For example, as described above, the non-separable secondary transformmay be performed based on the 8×8 transform or 4×4 transform determinedbased on the width (W) and the height (H) of the transform coefficientblock. For example, if the W and H are all equal to or larger than 8,the 8×8 transform may represent a transform that can be applied to the8×8 area included inside the corresponding transform coefficient block,and the 8×8 area may be the top-left 8×8 area inside the correspondingtransform coefficient block. Further, similarly, if the W and H are allequal to or larger than 4, the 4×4 transform may represent a transformthat can be applied to the 4×4 area included inside the correspondingtransform coefficient block, and the 4×4 area may be the top-left 4×4area inside the corresponding transform coefficient block. For example,an 8×8 transform kernel matrix may be a 64×64/16×64 matrix, and a 4×4transform kernel matrix may be a 16×16/8×16 matrix.

In this case, for mode-based transform kernel selection, twonon-separable secondary transform kernels per transform set for thenon-separable secondary transform may be configured with respect to allof the 8×8 transform and the 4×4 transform, and four transform sets maybe provided. That is, four transform sets may be configured with respectto the 8×8 transform, and four transform sets may be configured withrespect to the 4×4 transform. In this case, each of the four transformsets for the 8×8 transform may include two 8×8 transform kernels, andeach of the four transform sets for the 4×4 transform may include two4×4 transform kernels.

However, the size of the transform, the number of sets, and the numberof transform kernels in the set are exemplary, and a size excluding the8×8 or 4×4 may be used, or n sets may be configured, or k transformkernels may be included in each set. Here, n and k may be positiveintegers.

For example, the transform set may be called an NSST set, and thetransform kernel in the NSST set may be called an NSSAT kernel. Forexample, selection of a specific set among the transform sets may beperformed based on the intra prediction mode of the target block (CU orsubblock).

For example, the intra prediction mode may include two non-directionalor non-angular intra prediction modes and 65 directional or angularintra prediction modes. The non-directional intra prediction modes mayinclude No. 0 planar intra prediction mode and No. 1 DC intra predictionmode, and the directional intra prediction modes may include 65 (No. 2to No. 66) intra prediction modes. However, this is exemplary, and theembodiment according to the present document may be applied even to acase that a different number of intra prediction modes is provided.Meanwhile, in some cases, No. 67 intra prediction mode may be furtherused, and the No. 67 intra prediction mode may represent a linear model(LM) mode.

FIG. 5 exemplarily illustrates intra directional modes in 65 predictiondirections.

Referring to FIG. 5 , modes may be divided into intra prediction modeshaving horizontal directionality and intra prediction modes havingvertical directionality around No. 34 intra prediction mode havingtop-left diagonal prediction direction. In FIG. 5 , H and V may mean thehorizontal directionality and the vertical directionality, respectively,and numerals of −32 to 32 may represent displacements in the unit of1/32 on a sample grid position. This may represent an offset for a modeindex value.

For example, No. 2 to No. 33 intra prediction modes may have thehorizontal directionality, and No. 34 to No. 66 intra prediction modeshave the vertical directionality. Meanwhile, technically speaking, No.34 intra prediction mode may be considered to have neither thehorizontal directionality nor the vertical directionality, but may beclassified to belong to the horizontal directionality from the viewpointof determining the transform set of the secondary transform. This isbecause input data is transposed and used with respect to the verticaldirection modes being symmetrical around the No. 34 intra predictionmode, and an input data arrangement method for the horizontal directionmode is used with respect to the No. 34 intra prediction mode. Here,transposing of the input data may mean configuration of N×M data in amanner that rows become columns and columns become rows with respect totwo-dimensional block data M×N.

Further, No. 18 intra prediction mode and No. 50 intra prediction modemay represent a horizontal intra prediction mode and a vertical intraprediction mode, respectively, and No. 2 intra prediction mode may becalled top-right diagonal intra prediction mode since prediction is madein the top-right direction with a left reference pixel. In the samecontext, No. 34 intra prediction mode may be called a bottom-rightdiagonal intra prediction mode, and No. 66 intra prediction mode may becalled a bottom-left diagonal intra prediction mode.

Meanwhile, if it is determined that a specific set is used fornon-separable transform, one of k transform kernels in the specific setmay be selected through the non-separable secondary transform index. Forexample, the encoding apparatus may derive the non-separable secondarytransform index representing a specific transform kernel based on arate-distortion (RD) check, and may signal the non-separable secondarytransform index to the decoding apparatus. For example, the decodingapparatus may select one of the k transform kernels in the specific setbased on the non-separable secondary transform index. For example, anNSST index having a value of 0 may represent a first non-separablesecondary transform kernel, an NSST index having a value of 1 mayrepresent a second non-separable secondary transform kernel, and an NSSTindex having a value of 2 may represent a third non-separable secondarytransform kernel. Alternatively, an NSST index having a value of 0 mayrepresent that the first non-separable secondary transform is notapplied to the target block, and an NSST index having a value of 1 to 3may indicate the three transform kernels as above.

The transformer may perform the non-separable secondary transform basedon the selected transform kernels, and may obtain modified (secondary)transform coefficients. The modified transform coefficients may bederived as quantized transform coefficients through the above-describedquantizer, and may be encoded to be signaled to the decoding apparatusand may be transferred to the dequantizer/inverse transformer in theencoding apparatus.

Meanwhile, if the secondary transform is omitted as described above, the(primary) transform coefficients that are outputs of the primary(separable) transform may be derived as the quantized transformcoefficients through the quantizer as described above, and may beencoded to be signaled to the decoding apparatus and may be transferredto the dequantizer/inverse transformer in the encoding apparatus.

Referring again to FIG. 4 , the inverse transformer may perform a seriesof procedures in reverse order to the procedures performed by theabove-described transformer. The inverse transformer may receive(dequantized) transform coefficients, derive (primary) transformcoefficients by performing secondary (inverse) transform (S450), andobtain a residual block (residual samples) by performing primary(inverse) transform with respect to the (primary) transform coefficients(S460). Here, the primary transform coefficients may be called modifiedtransform coefficients on the inverse transformer side. As describedabove, the encoding apparatus and/or the decoding apparatus may generatea reconstructed block based on the residual block and a predicted block,and may generate a reconstructed picture based on this.

Meanwhile, the decoding apparatus may further include a secondaryinverse transform application/non-application determiner (or element fordetermining whether to apply the secondary inverse transform) and asecondary inverse transform determiner (or element for determining thesecondary inverse transform). For example, the secondary inversetransform application/non-application determiner may determine whetherto apply the secondary inverse transform. For example, the secondaryinverse transform may be NSST or RST, and the secondary inversetransform application/non-application determiner may determine whetherto apply the secondary inverse transform based on a secondary transformflag parsed or obtained from a bitstream. Alternatively, for example,the secondary inverse transform application/non-application determinermay determine whether to apply the secondary inverse transform based onthe transform coefficient of the residual block.

The secondary inverse transform determiner may determine the secondaryinverse transform. In this case, the secondary inverse transformdeterminer may determine the secondary inverse transform being appliedto the current block based on the NSST (or RST) transform set designatedin accordance with the intra prediction mode. Alternatively, a secondarytransform determination method may be determined depending on a primarytransform determination method. Alternatively, various combinations ofthe primary transform and the secondary transform may be determined inaccordance with the intra prediction mode. For example, the secondaryinverse transform determiner may determine an area to which thesecondary inverse transform is applied based on the size of the currentblock.

Meanwhile, if the secondary (inverse) transform is omitted as describedabove, the residual block (residual samples) may be obtained byreceiving the (dequantized) transform coefficients and performing theprimary (separable) inverse transform. As described above, the encodingapparatus and/or the decoding apparatus may generate a reconstructedblock based on the residual block and the predicted block, and maygenerate a reconstructed picture based on this.

Meanwhile, in the present document, in order to reduce a computationamount and a memory requirement amount being accompanied by thenon-separable secondary transform, a reduced secondary transform (RST)having a reduced size of the transform matrix (kernel) may be applied onthe concept of NSST.

In the present document, the RST may mean a (simplification) transformbeing performed with respect to the residual samples for the targetblock based on the transform matrix of which the size is reduced inaccordance with a simplification factor. In case of performing this, thecomputation amount being required during the transform may be reduceddue to the reduction of the size of the transform matrix. That is, theRST may be used to solve the computation complexity issue occurringduring the transform of a block having a large size or non-separabletransform.

For example, the RST may be referred to as various terms, such asreduced transform, reduced secondary transform, reduction transform,simplified transform, or simple transform, and names to which the RST isreferred are not limited to the enumerated examples. Further, the RST ismainly performed in a low-frequency domain including coefficients thatare not 0 in the transform block, and thus may be called a low-frequencynon-separable transform (LFNST).

Meanwhile, in case that the secondary inverse transform is performedbased on the RST, the inverse transformer 235 of the encoding apparatus200 and the inverse transformer 322 of the decoding apparatus 300 mayinclude an inverse RST unit deriving modified transform coefficientsbased on the inverse RST for the transform coefficients, and an inverseprimary transformer deriving residual samples for the target block basedon the inverse primary transform for the modified transformcoefficients. The inverse primary transform means an inverse transformof the primary transform having been applied to the residual. In thepresent document, derivation of the transform coefficients based on thetransform may mean derivation of the transform coefficients by applyingthe corresponding transform.

FIGS. 6 and 7 are diagrams explaining RST according to an embodiment ofthe present document.

For example, FIG. 6 may be a figure explaining that a forward reducedtransform is applied, and FIG. 7 may be a figure explaining that aninverse reduced transform is applied. In the present document, thetarget block may represent the current block, a residual block, or atransform block of which coding is performed.

For example, in the RST, an N-dimensional vector may be mapped on anR-dimensional vector located in another space, and a reduced transformmatrix may be determined. Here, N and R may be positive integers, and Rmay be smaller than N. N may mean a square of a length of one side of ablock to which transform is applied or the total number of transformcoefficients corresponding to the block to which the transform isapplied, and a simplification factor may mean an R/N value. Thesimplification factor may be referred to as various terms, such asreduced factor, reduction factor, simplified factor, or simple factor.Meanwhile, R may be referred to as a reduced coefficient, and in somecases, the simplification factor may mean the R. Further, in some cases,the simplification factor may mean the N/R value.

For example, the simplification factor or the reduced coefficient may besignaled through the bitstream, but is not limited thereto. For example,predefined values for the simplification factor or the reducedcoefficient may be stored in the encoding apparatus 200 and the decodingapparatus 300, and in this case, the simplification factor or thereduced coefficient may not be separately signaled.

For example, the size (R×N) of the simplification transform matrix maybe smaller than the size (N×N) of a regular transform matrix, and may bedefined as in the following equation.

$\begin{matrix}{T_{R \times N} = \begin{bmatrix}t_{11} & t_{12} & t_{13} & \ldots & t_{1N} \\t_{21} & t_{22} & t_{23} & \; & t_{2N} \\\; & \vdots & \; & \ddots & \vdots \\t_{R1} & t_{R2} & t_{R3} & \ldots & t_{RN}\end{bmatrix}} & {{Equation}\mspace{14mu} 4}\end{matrix}$

For example, the matrix T in the reduced transform block illustrated inFIG. 6 may represent the matrix T_(R×N) of Equation 4. As shown in FIG.6 , in case that the residual samples for the target block is multipliedby the simplification transform matrix T_(R×N), the transformcoefficients for the target block may be derived.

For example, in case that the size of the block to which the transformis applied is 8×8, and R is 16 (i.e., R/N=16/64=¼), the RST according toFIG. 6 may be expressed by a matrix operation as in Equation 5 below. Inthis case, the memory and the multiplication operation may be reduced toabout ¼ by the simplification factor.

In the present document, the matrix operation may be understood as anoperation of obtaining a column vector by placing the matrix on the leftside of the column vector and multiplying the matrix and the columnvector.

$\begin{matrix}{\begin{bmatrix}t_{1,1} & t_{1,2} & t_{1,3} & \ldots & t_{1,{64}} \\t_{2,1} & t_{2,2} & t_{2,3} & \; & t_{2,64} \\\; & \vdots & \; & \ddots & \vdots \\t_{{16},1} & t_{16,2} & t_{{16},3} & \ldots & t_{16,64}\end{bmatrix} \times \begin{bmatrix}r_{1} \\r_{2} \\\vdots \\r_{64}\end{bmatrix}} & {{Equation}\mspace{14mu} 5}\end{matrix}$

In Equation 5, r₁ to r₆₄ may represent residual samples for the targetblock. Alternatively, for example, they may be transform coefficientsgenerated by applying the primary transform. Based on the result of theoperation of Equation 5, transform coefficients c_(i) for the targetblock may be derived.

For example, in case that R is 16, transform coefficients c₁ to c₁₆ forthe target block may be derived. If the transform matrix having a sizeof 64×64 (N×N) through application of a regular transform rather thanthe RST is multiplied by the residual samples having a size of 64×1(N×1), 64 (N) transform coefficients for the target block may bederived, but since the RST is applied, only 16 (N) transformcoefficients for the target block may be derived. Since the total numberof transform coefficients for the target block is reduced from N to R,the amount of data that the encoding apparatus 200 transmits to thedecoding apparatus 300 may be reduced, and thus transmission efficiencybetween the encoding apparatus 200 and the decoding apparatus 300 may beincreased.

In consideration of the size of the transform matrix, since the size ofthe regular transform matrix is 64×64 (N×N), and the size of thesimplification transform matrix is reduced to 16×64 (R×N), the memoryusage when performing the RST can be reduced in an R/N ratio as comparedwith a case that the regular transform is performed. Further, ascompared with the number (N×N) of multiplication operations when usingthe regular transform matrix, the usage of the simplification transformmatrix can reduce the number of multiplication operations (R×N) in theR/N ratio.

In an embodiment, the transformer 232 of the encoding apparatus 200 mayderive the transform coefficients for the target block by performingprimary transform and RST-based secondary transform of the residualsamples for the target block. The transform coefficients may betransferred to the inverse transformer of the decoding apparatus 300,and the inverse transformer 322 of the decoding apparatus 300 may derivethe modified transform coefficients based on inverse reduced secondarytransform (RST) for the transform coefficients, and may derive theresidual samples for the target block based on the inverse primarytransform of the modified transform coefficients.

The size of the inverse RST matrix T_(N×R) according to an embodimentmay be N×R that is smaller than the size N×N of the regular inversetransform matrix, and may be in transpose relationship with thesimplification transform matrix T_(R×N) illustrated in Equation 4.

The matrix T_(t) in the reduced inverse transform block illustrated inFIG. 7 may represent an inverse RST matrix T_(R×N) ^(T). Here, thesuperscript T may represent the transpose. As shown in FIG. 7 , in casethat the transform coefficients for the target block is multiplied bythe inverse RST matrix T_(R×N) ^(T), the modified transform coefficientsfor the target block or the residual samples for the target block may bederived. The inverse RST matrix T_(R×N) ^(T) may be expressed as(T_(R×N))^(T) _(N×R).

More specifically, in case that the inverse RST is applied as thesecondary inverse transform, the modified transform coefficients for thetarget block may be derived by multiplying the transform coefficientsfor the target block by the inverse RST matrix T_(R×N) ^(T). Meanwhile,the inverse RST may be applied as the inverse primary transform, and inthis case, the residual samples for the target block may be derived bymultiplying the transform coefficients for the target block by theinverse RST matrix T_(R×N) ^(T).

In an embodiment, in case that the size of the block to which theinverse transform is applied is 8×8, and R is 16 (i.e., R/N=16/64=¼),the RST according to FIG. 7 may be expressed by a matrix operation as inEquation 6 below.

$\begin{matrix}{\begin{bmatrix}t_{1,1} & t_{2,1} & \; & t_{16,1} \\t_{1,2} & t_{2,2} & \ldots & t_{16,2} \\t_{1,3} & t_{2,3} & \; & t_{16,3} \\\vdots & \; & \ddots & \vdots \\t_{1,64} & t_{2,64} & \ldots & t_{16,64}\end{bmatrix} \times \begin{bmatrix}c_{1} \\c_{2} \\\vdots \\c_{16}\end{bmatrix}} & {{Equation}\mspace{14mu} 6}\end{matrix}$

In Equation 6, c₁ to c₁₆ may represent transform coefficients for thetarget block. r_(j) representing the modified transform coefficients forthe target block or the residual samples for the target block may bederived based on the result of the operation of Equation 6. That is, r₁to r_(N) representing the modified transform coefficients for the targetblock or the residual samples for the target block may be derived.

In consideration of the size of the inverse transform matrix, since thesize of the regular inverse transform matrix is 64×64 (N×N), and thesize of the simplification inverse transform matrix is reduced to 64×16(N×R), the memory usage when performing the inverse RST can be reducedin an R/N ratio as compared with a case that the regular inversetransform is performed. Further, as compared with the number (N×N) ofmultiplication operations when using the regular inverse transformmatrix, the usage of the simplification inverse transform matrix canreduce the number of multiplication operations (N×R) in the R/N ratio.

Meanwhile, transform sets may be configured and applied even withrespect to 8×8 RST. That is, the corresponding 8×8 RST may be applied inaccordance with the transform set. Since one transform set is composedof two or three transform kernels in accordance with the intraprediction mode, it may be configured to select one of four transformsat maximum including even a case that the secondary transform is notapplied. In the transform when the secondary transform is not applied,it may be considered that an identity matrix has been applied. If it isassumed that an index of 0, 1, 2, or 3 is given for four transforms(e.g., No. 0 index may be allocated to a case that the identity matrix,that is, secondary transform, is not applied), the transform to beapplied may be designated by signaling a syntax element that is an NSSTindex to every transform coefficient block. That is, through the NSSTindex, 8×8 NSST may be designated for an 8×8 top-left block, and in theRST configuration, 8×8 RST may be designated. The 8×8 NSST and the 8×8RST may represent transforms capable of being applied to the 8×8 areaincluded inside the corresponding transform coefficient block in casethat the W and the H of the target block that becomes the target of thetransform are all equal to or larger than 8, and the 8×8 area may be thetop-left 8×8 area inside the corresponding transform coefficient block.Similarly, the 4×4 NSST and the 4×4 RST may represent transforms capableof being applied to the 4×4 area included inside the correspondingtransform coefficient block in case that the W and the H of the targetblock are all equal to or larger than 4, and the 4×4 area may be thetop-left 4×4 area inside the corresponding transform coefficient block.

Meanwhile, for example, the encoding apparatus may derive the bitstreamby encoding the value of the syntax element or the quantized values ofthe transform coefficient for the residual based on various codingmethods, such as exponential Golomb, context-adaptive variable lengthcoding (CAVLC), context-adaptive binary arithmetic coding (CABAC), andthe like. Further, the decoding apparatus may derive the value of thesyntax element or the quantized values of the transform coefficient forthe residual based on various coding methods, such as exponential Golombencoding, CAVLC, CABAC, and the like.

For example, the above-described coding methods may be performed as thecontents to be described later.

FIG. 8 exemplarily illustrates context-adaptive binary arithmetic coding(CABAC) for encoding a syntax element.

For example, in a CABAC coding process, if an input signal is a syntaxelement that is not a binary value, a value of the input signal may betransformed into a binary value through binarization. Further, if theinput signal is already the binary value (i.e., if the value of theinput signal is the binary value), the binarization may not beperformed, but the input signal may be used as it is. Here, each binarynumber 0 or 1 constituting the binary value may be called a bin. Forexample, if a binary string after the binarization is 110, each of 1, 1,and 0 may be represented as one bin. The bin(s) for one syntax elementmay represent the value of the syntax element. The binarization may bebased on various binarization method, such as a truncated ricebinarization process or a fixed-length binarization process, and thebinarization method for a target syntax element may be predefined. Thebinarization procedure may be performed by a binarizer in an entropyencoder.

Thereafter, the binarized bins of the syntax element may be input to aregular coding engine or a bypass coding engine. The regular codingengine of the encoding apparatus may allocate a context model thatreflects a probability value with respect to the corresponding bin, andencode the corresponding bin based on the allocated context model. Theregular coding engine of the encoding apparatus may update the contextmodel for the corresponding bin after performing coding with respect tothe respective bins. The bins being coded as the above-describedcontents may be represented as context-coded bins.

Meanwhile, in case that the binarized bins of the syntax element areinput to the bypass coding engine, they may be coded as follows. Forexample, the bypass coding engine of the encoding apparatus may omit aprocedure for estimating probability with respect to the input bin and aprocedure for updating a probability model having been applied to thebin after the coding. In case that the bypass coding is applied, theencoding apparatus may code the input bin by applying regularprobability distribution instead of allocating the context model, andthrough this, the coding speed can be improved. The bin being coded asthe above-described contents may be represented as a bypass bin.

Entropy decoding may represent a process for performing the same processas the above-described entropy encoding in reverse order.

The decoding apparatus (entropy decoder) may decode encoded image/videoinformation. The image/video information may includepartitioning-related information, prediction-related information (e.g.,inter/intra prediction division information, intra prediction modeinformation, inter prediction mode information, and the like), residualinformation, or in-loop filtering-related information, or may includevarious syntax elements thereabout. The entropy coding may be performedin the unit of a syntax element.

The decoding apparatus may perform binarization of target syntaxelements. Here, the binarization may be based on various binarizationmethods, such as a truncated rice binarization process or a fixed-lengthbinarization process, and the binarization method for the target syntaxelement may be predefined. The decoding apparatus may derive availablebin strings (bin string candidates) for available values of the targetsyntax elements through the binarization procedure. The binarizationprocedure may be performed by the binarizer in the entropy decoder.

The decoding apparatus may compare the derived bin string with availablebin strings for the corresponding syntax elements while sequentiallydecoding or parsing the respective bins for the target syntax elementsfrom input bit(s) in the bitstream. If the derived bin string is equalto one of the available bin strings, the value corresponding to thecorresponding bin string is derived as the value of the correspondingsyntax element. If not, the decoding apparatus may re-perform theabove-described procedure after further parsing the next bit in thebitstream. Through such a process, it is possible to perform signalingof specific information (or specific syntax element) in the bitstreamusing a variable length bit even without using a start bit or an end bitof the corresponding information. Through this, a relatively smaller bitmay be allocated with respect to a smaller value, and thus an overallcoding efficiency can be enhanced.

The decoding apparatus may perform context model-based or bypass-baseddecoding of the respective bins in the bin string from the bitstreambased on an entropy coding technique, such as CABAC or CAVLC.

In case that the syntax element is decoded based on the context model,the decoding apparatus may receive the bin corresponding to the syntaxelement through the bitstream, may determine a context model using thesyntax element and decoding information of the decoding target block orthe neighboring block or symbol/bin information decoded in the previousstage, and may derive the syntax element value by performing arithmeticdecoding of the bin through prediction of the probability of occurrenceof the received bin in accordance with the determined context model.Thereafter, the context model of the bin being next decoded may beupdated based on the determined context model.

The context model may be allocated and updated by context-coded(regularly coded) bins, and the context model may be indicated based oncontext index (ctxIdx) or context index increment (ctxInc). CtxIdx maybe derived based on ctxInc. Specifically, for example, the ctxIdxrepresenting the context model for each of the regularly coded bins maybe derived by the sum of ctxInc and context index offset (ctxIdxOffset).For example, the ctxInc may be differently derived by bins. ThectxIdxOffset may be represented as the lowest value of the ctxIdx.Generally, the ctxIdxOffset may be a value being used to distinguish thesame from context models for other syntax elements, and the contextmodel for one syntax element may be divided or derived based on thectxInc.

In the entropy encoding procedure, it may be determined whether toperform encoding through the regular coding engine or to performencoding through the bypass coding engine, and accordingly, a codingpath may be switched. Entropy decoding may perform the same process asthe entropy encoding in reverse order.

Meanwhile, for example, in case that the syntax element isbypass-decoded, the decoding apparatus may receive the bin correspondingto the syntax element through the bitstream, and may decode the inputbin by applying regular probability distribution. In this case, thedecoding apparatus may omit a procedure of deriving the context model ofthe syntax element and a procedure of updating the context model appliedto the bin after the decoding.

As described above, the residual sample may be derived as quantizedtransform coefficients through the transform and quantization processes.The quantized transform coefficients may be called transformcoefficients. In this case, the transform coefficients in the block maybe signaled in the form of residual information. The residualinformation may include a syntax or a syntax element about residualcoding. For example, the encoding apparatus may encode the residualinformation, and may output the same in the form of a bitstream, and thedecoding apparatus may decode the residual information from thebitstream, and may derive the residual (quantized) transformcoefficients. As described later, the residual information may includesyntax elements representing whether the transform has been applied tothe corresponding block, where is the location of the last effectivetransform coefficient in the block, whether an effective transformcoefficient exists in the subblock, or how the size/sign of theeffective transform coefficient is.

Meanwhile, for example, the predictor in the encoding apparatus of FIG.2 or the predictor in the decoding apparatus of FIG. 3 may perform intraprediction. The intra prediction will be described in more detail asfollows.

The intra prediction may represent a prediction for generatingprediction samples for the current block based on reference samples inthe picture (hereinafter, current picture) to which the current blockbelongs. In case that the intra prediction is applied to the currentblock, neighboring reference samples to be used for the intra predictionof the current block may be derived. The neighboring reference samplesof the current block may include a sample adjacent to a left boundary ofthe current block having a size of nW×nH, total 2×nH samples neighboringthe bottom-left, a sample adjacent to the top boundary of the currentblock, total 2×nW samples neighboring the top-right, and one sampleneighboring the top-left of the current block. Alternatively, theneighboring reference samples of the current block may include topneighboring sample of plural columns and left neighboring sample ofplural rows. Alternatively, the neighboring reference samples of thecurrent block may include total nH samples adjacent to the rightboundary of the current block having a size of nW×nH, total nH samplesadjacent to the right boundary of the current block, total nW samplesadjacent to the bottom boundary of the current block, and one sampleneighboring the bottom-right of the current block.

However, some of the neighboring reference samples of the current blockmay have not yet been decoded or may not be available. In this case, thedecoder may configure the neighboring reference samples to be used forthe prediction through substitution of available samples for theunavailable samples. Alternatively, the neighboring reference samples tobe used for the prediction may be configured through interpolation ofthe available samples.

In case that the neighboring reference samples are derived, (i) aprediction sample may be induced based on an average or interpolation ofthe neighboring reference samples of the current block, and (ii) aprediction sample may be induced based on a reference sample existing ina specific (prediction) direction with respect to the prediction sampleamong the neighboring reference samples of the current block. The caseof (i) may be called a non-directional mode or a non-angular mode, andthe case of (ii) may be called a directional mode or an angular mode.

Further, the prediction sample may be generated through interpolationbetween the first neighboring sample and the second neighboring samplelocated in an opposite direction to the prediction direction of theintra prediction mode of the current block based on the predictionsample of the current block among the neighboring reference samples. Theabove-described case may be called a linear interpolation intraprediction (LIP). Further, chroma prediction samples may be generatedbased on luma samples using a linear model. This case may be called alinear model (LM) mode. Alternatively, the prediction sample of thecurrent block may be derived by deriving a temporary prediction sampleof the current block based on the filtered neighboring reference samplesand performing weighted sum of the temporary prediction sample and atleast one reference sample derived in accordance with the intraprediction mode among the non-filtered neighboring reference samples.The above-described case may be called a position dependent intraprediction (PDPC). Alternatively, the intra prediction coding may beperformed in a method for deriving a prediction sample using a referencesample located in the prediction direction in reference sample linehaving the highest prediction accuracy through selection of thecorresponding line among neighboring multi-reference sample lines of thecurrent block, and for indicating (signaling) the reference sample lineused at that time to the decoding apparatus. The above-described casemay be called a multi-reference line (MRL) intra prediction or MRL-basedintra prediction. Further, in performing the intra prediction based onthe same intra prediction modes through division of the current blockinto vertical or horizontal sub-partitions, the neighboring referencesamples may be derived and used in the unit of the sub-partition. Thatis, the intra prediction mode for the current block may be equallyapplied to the sub-partitions, and in this case, since the neighboringreference samples are derived and used in the unit of the sub-partition,the intra prediction performance can be enhanced in some cases. Thisprediction method may be called an intra sub-partitions (ISP) orISP-based intra prediction.

The above-described intra prediction methods may be called an intraprediction type in distinction from the intra prediction mode. The intraprediction type may be called various terms, such as an intra predictiontechnique or an additional intra prediction mode. For example, the intraprediction type (or additional intra prediction mode) may include atleast one of LIP, PDPC, MRL, and ISP as described above. A general intraprediction method excluding the specific intra prediction type, such asthe LIP, PDPC, MRL, or ISP, may be called a normal intra predictiontype. In case that the above-described specific intra prediction type isnot applied, the normal intra prediction type may be generally applied,and the prediction may be performed based on the above-described intraprediction mode. Meanwhile, as needed, a post-filtering for the derivedprediction sample may be performed.

In other words, the intra prediction procedure may include intraprediction mode/type determination, neighboring reference samplederivation, and intra prediction mode/type based prediction samplederivation. Further, as needed, a post-filtering for the derivedprediction sample may be performed.

Meanwhile, among the above-described intra prediction types, the ISP maydivide the current block in a horizontal direction or a verticaldirection, and may perform intra prediction in the unit of dividedblocks. That is, the ISP may derive subblocks by dividing the currentblock in the horizontal direction or vertical direction, and may performintra prediction for each of the subblocks. In this case, areconstructed block may be generated through performing ofencoding/decoding in the unit of the divided subblock, and thereconstructed block may be used as a reference block of the next dividedsubblock. Here, the subblock may be called an intra sub-partition.

For example, in case that the ISP is applied, the current block may bedivided into two or four subblocks in the vertical or horizontaldirection based on the size of the current block.

For example, in order to apply the ISP, a flag representing whether toapply the ISP may be transmitted in the unit of a block, and in casethat the ISP is applied to the current block, a flag representingwhether the partitioning type is horizontal or vertical, that is,whether the partitioning direction is a horizontal direction or verticaldirection, may be encoded/decoded. The flag representing whether toapply the ISP may be called an ISP flag, and the ISP flag may berepresented as an intra_subpartitions_mode_flag syntax element. Further,the flag representing the partitioning type may be called an ISPpartitioning flag, and the ISP partitioning flag may be represented asan intra_subpartitions_split_flag syntax element.

For example, by the ISP flag or the ISP partitioning flag, informationrepresenting that the ISP is not applied to the current block(IntraSubPartitionsSplitType==ISP_NO_SPLIT), information representingpartitioning in the horizontal direction(IntraSubPartitionsSplitType==ISP_HOR_SPLIT), information representingpartitioning in the vertical direction(IntraSubPartitionsSplitType==ISP_VER_SPLIT) may be represented. Forexample, the ISP flag or the ISP partitioning flag may be calledISP-related information on sub-partitioning of the block.

Meanwhile, in addition to the above-described intra prediction types, anaffine linear weighted intra prediction (ALWIP) may be used. The ALWIPmay be called a linear weighted intra prediction (LWIP), a matrixweighted intra prediction (MWIP), or a matrix based intra prediction(MIP). In case that the ALWIP is applied to the current block, i) usingneighboring reference samples of which an averaging procedure has beenperformed, ii) a matrix-vector-multiplication procedure may beperformed, and iii) as needed, prediction samples for the current blockmay be derived by further performing a horizontal/vertical interpolationprocedure.

The intra prediction modes used for the ALWIP may be the above-describedLIP, PDPC, MRL, or ISP intra prediction, but may be configureddifferently from the intra prediction modes used in the normal intraprediction. The intra prediction mode for the ALWIP may be called anALWIP mode. For example, in accordance with the intra prediction modefor the ALWIP, the matrix and the offset being used in the matrix vectormultiplication may be differently configured. Here, the matrix may becalled an (affine) weight matrix, and the offset may be called an(affine) offset vector or an (affine) bias vector. In the presentdocument, the intra prediction mode for the ALWIP may be called an ALWIPmode, an ALWIP intra prediction mode, an LWIP mode, an LWIP intraprediction mode, an MWIP mode, an MWIP intra prediction mode, an MIPmode, or an MIP intra prediction mode. A detailed ALWIP method will bedescribed later.

FIG. 9 is a diagram explaining an MIP for 8×8 block.

In order to predict samples of a rectangular block having a width W anda height H, the MIP may use samples neighboring the left boundary of theblock and sample neighboring the top boundary. Here, the samplesneighboring the left boundary may represent samples located in one lineadjacent to the left boundary of the block, and may representreconstructed samples. The samples neighboring the top boundary mayrepresent samples located in one line adjacent to the top boundary ofthe block, and may represent reconstructed samples.

For example, if the reconstructed samples are not available, thereconstructed samples as in the intra prediction in the related art maybe generated or derived, and may be used.

A prediction signal (or prediction samples) may be generated based on anaveraging process, a matrix vector multiplication process, and a(linear) interpolation process.

For example, the averaging process may be a process for extractingsamples out of the boundary through averaging. For example, if the widthW and the height H of the samples are all 4, the samples being extractedmay be four samples, and may be 8 samples in another case. For example,in FIG. 9 , bdry_(left) and bdry_(top) may represent extracted leftsamples and top samples, respectively.

For example, the matrix vector multiplication process may be a processof performing matrix vector multiplication with the averaged samples asinputs. Further, an offset may be added. For example, in FIG. 9 , A_(k)may represent a matrix, b_(k) may represent an offset, and bdry_(red)may be a reduced signal for the samples extracted through the averagingprocess. Further, bdry_(red) may be reduced information on bdry_(left)and bdry_(top). The result may be a reduced prediction signal pred_(red)for a set of sub-sampled samples in the original block.

For example, the (linear) interpolation process may be a process inwhich a prediction signal is generated in the remaining locations fromthe prediction signal for the set sub-sampled by the linearinterpolation. Here, the linear interpolation may represent a singlelinear interpolation in respective directions. For example, the linearinterpolation may be performed based on the reduced prediction signalpred_(red) marked in gray in the block in FIG. 9 and neighboringboundary samples, and through this, all prediction samples in the blockmay be derived.

For example, the matrixes (A_(k) in FIG. 9 ) and offset vectors (b_(k)in FIG. 9 ) required to generate the prediction signal (or predictionblock or prediction samples) may be brought from three sets S₀, S₁, andS₂. For example, the set S₀ may be composed of 18 matrixes (A₀ ^(i),i=0, 1, . . . , 17) and 18 offset vectors (b₀ ^(i), i=0, 1, . . . , 17).Here, each of 18 matrixes may have 16 rows and 4 columns, and each of 18offset vectors may have 16 sizes. The matrixes and the offset vectors ofthe set S₀ may be used for a block having a size of 4×4. For example,the set S₁ may be composed of 10 matrixes (A₁ ^(i), i=0, 1, . . . , 9)and 10 offset vectors (b₁ ^(i), i=0, 1, . . . , 9). Here, each of 10matrixes may have 16 rows and 8 columns, and each of 10 offset vectorsmay have 16 sizes. The matrixes and the offset vectors of the set S₁ maybe used for a block having a size of 4×8, 8×4, or 8×8. For example, theset S₂ may be composed of 6 matrixes (A₂ ^(i), i=0, 1, . . . , 5) and 6offset vectors (b₂ ^(i), i=0, 1, . . . , 5). Here, each of 6 matrixesmay have 64 rows and 8 columns, and each of 6 offset vectors may have 64sizes. The matrixes and the offset vectors of the set S₂ may be used forall the remaining blocks.

Meanwhile, in an embodiment of the present document, LFNST indexinformation may be signaled with respect to the block to which the MIPis applied. Alternatively, the encoding apparatus may generate abitstream by encoding the LFNST index information for transforming theblock to which the MIP is applied, and the decoding apparatus may obtainthe LFNST index information for transforming the block to which the MIPis applied by parsing or decoding the bitstream.

For example, the LFNST index information may be information fordiscriminating the LFNST transform set in accordance with the number oftransforms constituting the transform set. For example, an optimum LFNSTkernel may be selected with respect to the block in which the intraprediction to which the MIP is applied based on the LFNST indexinformation. For example, the LFNST index information may be representedas st_idx syntax element or lfnst_idx syntax element.

For example, the LFNST index information (or st_idx syntax element) maybe included in the syntax as in the following tables.

TABLE 2 coding_unit( x0, y0, cbWidth cbHeight, treeType ) { Descriptor if( tile_group_type != I || sps_ibc_enabled_flag ) {   if( treeType !=DUAL_TREE_CHROMA )    cu_skip_flag[ x0 ][ y0 ] ae(v)   if( cu_skip_flag[x0 ][ y0 ] = = 0 && tile_group_type != I)    pred_mode_flag ae(v)   if(( ( tile_group_type = = I && cu_skip_flag[ x0 ][ y0 ] = =0 ) ||    (tile_group_type != I && CuPredMode[ x0 ][ y0 ] != MODE_INTRA ) ) &&   sps_ibc_enabled_flag )    pred_mode_ibc_flag ae(v)  }  if(CuPredMode[ x0 ][ y0 ] = = MODE_INTRA ) {   if( sps_pcm_enabled flag &&   cbWidth >= MinIpcmCbSizeY && cbWidth <= MaxIpcmCbSizeY &&   cbHeight >= MinIpcmCbSizeY && cbHei2ht <= MaxIpcinCbSizeY )   pcm_flag[ x0 ][ y0 ] ae(v)   if( pcm_flag[ x0 ][ y0] ) {    while(!byte_aligned( ) )     pcm_alignment_zero_bit f( I)    pcm_sample(cbWidth, cbHeight, treeType)   }else {    if( treeType = = SINGLE_TREE|| treeType = = DUAL_TREE_LUMA ) {     if( Abs( Log2( cbWidth ) − Log2(cbHeight ) ) <= 2 )      intra_mip_flag[ x0 ][ y0 ] ae(v)     if(intra_mip flag[ x0 ][ y0 ] ) {       intra_mip_mpm_flag[ x0 ][ y0 ]ae(v)      if( intra_mip_mpm_flag[ x0 ][ y0 ])       intra_mip_mpm_idx[x0 ][ y0 ] ae(v)      Else       intra_mip_mpm_remainder[ x0 ][ y0 ]ae(v)     }else {     if( ( y0 % CtbSizeY ) > 0)     intra_luma_ref_idx[ x0 ][ y0 ] ae(v)     if (intra_luma_ref_idx[ x0][ y0 ] = = 0 &&      ( cbWidth <= MaxTbSizeY || cbHeight <= MaxTbSizeY) &&      ( cbWidth * cbHeight > MinTbSizeY * MinTbSizeY ))     intra_subpartitions_mode_flag[ x0 ][ y0 ] ae(v)     if(intra_subpartitions_mode_flag[ x0 ][ y0 ] = = 1 &&      cbWidth <=MaxTbSizeY && cbHeight <= MaxTbSizeY )     intra_subpartitions_split_flag[ x0 ][ y0 ] ae(v)     if(intra_luma_ref_idx[ x0 ][ y0 ] = = 0 &&     intra_subpartitions_mode_flag[ x0 ][ y0 ] = = 0 )     intra_luma_mpm_flag[ x0 ][ y0 ] ae(v)     if( intra_luma_mpm_flag[x0 ][ y0 ] )      intra_luma_mpm_idx[ x0 ][ y0 ] ae(v)     else     intra_luma_mpm_remainder[ x0 ][ y0 ] ae(v)     }    }    if(treeType = = SINGLE_TREE || treeType = = DUAL_TREE_CHROMA )    intra_chroma_pred_mode[ x0 ][ y0 ] ae(v)   }  } else if( treeType !=DUAL_TREE_CHROMA ) {MODE_INTER or MODE_IBC */   if( cu_skip_flag[ x0 ][y0 ] = = 0)

TABLE 3  merge_flag[ x0 ][ y0] ae(v) if( merge_flag[ x0 ][ y0 ] ) { merge_data( x0, y0, cbWidth, cbHeight ) } else if( CuPredMode[ x0 ][ y0] = = MODE_IBC ) {  mvd_coding( x0, y0, 0, 0)  mvp_10_flag[ x0 ][ y0]ae(v)  if( sps_amwr_enabled_flag &&   ( MvdL0[ x0 ][ y0][ 0 ] != 0 |MvdL0[ x0 ][ y0 ][ 1] != 0 ) ) {   amvr_precision_flag[ x0 ][ y0 ] ae(v) } } else {  if( tile_group_type = = B )   inter_pred_idc[ x0 ][ y0 ]ae(v)  if( sps_affine_enabled_flag && cbWidth >= 16 && cbHeight .>= 16){   inter_affine_flag[ x0 ][ y0 ] ae(v)   if( sps_affine_type_flag &&inter_affine_flag[ x0 ][ y0 ])    cu_affine_type_flag[ x0 ][ y0] ae(v) }  if( inter_pred_idc[ x0 ][ y0 ] = = PRED_BI && !inter_affine_flag[ x0][ y0] &&    RefIdxSyinLO > −1 && RefIdxSyinL1 > −1)   sym_mvd_flag[ x0][ y0 ] ae(v)  if( inter_pred_idc[ x0 ][ y0 ] != PRED_Ll ) {   if(NumRefIdxActive[ 0 ] > 1 && !sym_mvd_flag[ x0 ][ y0 ] )    ref_idx_10[x0 ][ y0 ] ae(v)   mvd_coding( x0, y0, 0, 0)   if( MotionModelldc[ x0 ][y0 ] > 0)    mvd_coding( x0, y0, 0, 1)   if(Motion_ModelIdc[ x0 ][ y0]> 1)    mvd_coding( x0, y0, 0, 2)   mvp_10_flag[ x0 ][ y0 ] ae(v)  }else {   MvdL0[ x0 ][ y0 ][ 0 ] = 0   MvdL0[ x0 ][ y0 ][ 1 ] = 0  }  if(inter_pred_idc[ x0 ][ y0 ] != PRED_L0 ) {   if( NumRefIdxActive[ 1] > 1&& !sym_mvd_flag[ x0 ][ y0 ] )    ref_idx_11[ x0 ][ y0 ] ae(v)   if(mvd_11_zero_flag && inter_pred_ide[ x0 ][ y0 ] = = PRED_BI ) {    MvdL1[ x0 ][y0 ][ 0 ]= 0     MvdL1[ x0 ][ y0 ][ 1 ] = 0     MvdCpL1[x0 ][ y0 ][ 0 ][ 0 ] = 0     MvdCpL1[ x0 ][ y0][ 0 ][ 1] = 0    MvdCpL1[ x0 ][ y0 ][ 1 ][ 0 ] = 0     MvdCpL1[ x0 ][ y0 ][ 1 ][ 1] =0     MvdCpL1[ x0 ][ y0 ][ 2 ][ 0 ] = 0     MvdCpL1[ x0 ][ y0 ][ 2 ][ 1] = 0   } else {    if( sym_mvd_flag[ x0 ][ y0 ]) {     MvdL1[ x0 ][ y0][ 0 ] = −MvdL0[ N0 ][ y0 ][ 0 ]     MvdL1[ x0 ][ y0 ][ 1 ] = −MvdL0[ x0][ y0 ][ 1 ]    } else     mvd_coding( x0, y0, 1, 0)

TABLE 4    if( MotionModelIdc[ x0 ][ y0 ] > 0 )     mvd_coding( x0, y0,1, 1)    if(MotionModelIdc[ x0 ][ y0 ] > 1)     mvd_coding( x0, y0, 1,2)    mvp_11_flag[ x0 ][ y0 ] ae(v)   }  } else {   MvdL1[ x0 ][ y0 ][ 0] = 0   MvdL1[ x0 ][ y0 ][ 1] = 0  }  if( ( sps_amvr_enabled_flag &&inter_affine_flag = = 0 &&   ( MvdL0[ x0 ][ y0 ][ 0 ] != 0 || MvdL0[ x0][ y0 ][ 1 ] != 0 ||    MvdL1[ x0 ][ y0 ][ 0 ] != 0 | MvdL1 [ x0 ][ y0][ 1 ] != 0 ) ) ||   ( sps_affine_amvr_enabled_flag &&inter_affine_flag[ x0 ][ y0 ] = = 1 &&   ( MvdCpL0[ x0 ][ y0 ][ 0 ][ 0 ]!= 0 MvdCpL0[ x0 ][ y0 ][ 0 ] [1] != 0 ||    MvdCpL1[ x0 ][ y0 ][ 0 ][ 0] != 0 || MvdCpL1[ x0 ][ y0 ][ 0 ][ 1 ] != 0 ||    MvdCpL0[ x0 ][ y0 ][1 ][ 0 ] != 0 || MvdCpL0[ x0 ][ y0 ][ 1 ] != 0 ||    MvdCpL1[ x0 ][ y0][ 1 ][ 0 ] != 0 || MvdCpL1[ x0 ][ y0 ][ 1 ] [1] !=0 ||    MvdCpL0[ x0][ y0 ][ 2 ][ 0 ] != 0 || MvdCpL0[ x0 ][ y0 ][ 2 ] [ 1 ] !=0 ||   MvdCpL1[ x0 ][ y0 ][ 2 ][ 0 ] != 0 || MvdCpL1[ x0 ][ y0 ][ 2 ][ 1 ]!= 0 )) {   amvr_flag[ x0 ][ y0 ] ae(v)   if( amvr_flag[ x0 ][ y0 ] )   amvr_precision_flag[ x0 ][ y0 ] ae(v)  }   if( sps_gbi_enabled_flag&& inter_pred_idc[ x0 ][ y0 ] = = PRED_BI &&    luma_weight_10_flag[ref_idx_10 [ x0 ][ y0 ]] = = 0 &&    luma_weight_11_flag[ ref_idx_l1 [x0 ][ y0 ]] = = 0 &&    chroma_weight_10_flag( ref_idx_10 [ x0 ][ y0 ]]= = 0 &&    chroma_weight_11_flag( ref_idx_11 [ x0 ]] y0 ]] = = 0 &&   cbWidth * cbHeight >= 256 )   gbi_idx[ x0 ][ y0] ae(v)  } } if(!pcm_flag[ x0 ][ y0 ] ) {  if( CuPredMode[ x0 ][ y0 ] != MODE_INTRA &&merge_flag[ x0 ][ y0 ] = = 0)   cu_cbf ae(v)  if( cu_cbf ) {   if(CuPredMode[ x0 ][ y0 ] == MODE_INTER && sps_sbt_enabled_flag &&    !ciipflag[ x0 ][ y0 ] ) {    if( cbWidth <= MaxSbtSize && cbHeight <=MaxSbtSize ) {    allowSbtVerH = cbWidth ) >= 8    allowSbtVerQ =cbWidth >= 16    allowSbtHorH = cbHeight >= 8    allowSbtHorQ =cbHeight >= 16    if( allowSbtVerH || allowSbtliorH || allowSbtVerQ ||allowSbtHorQ )     cu_sbt_flag ae(v)   }   if( cu_sbt_flag ) {    if( (allowSbtVerH || allowSbtHorH ) && ( allowSblVerQ || allowSbtHorQ) )    cu_sbt_quad_flag ae(v)    if( ( cu_sbt_gtiadillag && allowSbtVerQ &&allowSbtHorQ) I     ( !cu sbt quad flag && allowSbfVerH && allowSbtHorH) )     cu_sbt_horizontal_flag ae(v)    cu_sbt_pos_flag ae(v)   }  } numSigCoeff = 0

TABLE 5    numZeroOutSigCoeff = 0    transfonn_tree( x0, y0, cbWidth.cbHeight, treeType )    if( Min( cbWidth, cbHeight ) >= 4 &&sps_st_enabled_ftag == 1 &&      CuPredMode[ x0 ][ y0 ] = = MODE_INTRA     && IntraSubPartitionsSplitType == ISP_NO_SPLIT ) {      if( (numSigCoeff > ( ( treeType == SINGLE TREE) ? 2 : 1 ) ) &&      numZeroOutSigCoeff == 0) {      st_idx[ x0 ][ y0 ] ae(v)     }   }   }  } }

Table 2 to Table 5 as above may successively represent one syntax orinformation.

For example, in Table 2 to Table 5, information or semantics representedby an intra_mip_flag syntax element, an intra_mip_mpm_flag syntaxelement, an intra_mip_mpm_idx syntax element, an intra_mip_mpm_remaindersyntax element, or a st_idx syntax element may be as in the followingtable.

TABLE 6 intra_mip_flag[ x0 ][ y0 ] equal to 1 specifies that the intraprediction type for luma samples is matrix based intra prediction.intra_mip_flag[ x0 ][ y0 ] equal to 0 specifies that the intraprediction type for luma samples is not matrix based intra prediction.When intra_mip_flag[ x0 ][ y0 ] is not present, it is inferred to beequal to 0. The syntax elements intra_mip_mpm_flag [ x0 ][ y0 ],intra_mip_mpm_idx[ x0 ][ y0 ] and intra_mip_mpm_remainder[ x0 ][ y0 ]specify the matrix based intra prediction mode for luma samples. Thearray indices x0, y0 specify the location ( x0 , y0 ) of the top-leftluma sample of the considered coding block relative to the top-left lumasample of the picture. When intra_mip_mpm_flag[ x0 ][ y0 ] is equal to1, the matrix based intra prediction mode is inferred from aneighbouring intra-predicted coding unit. When intra_mip_mpm_flag[ x0 ][y0] is not present, it is inferred to be equal to 1. st_idx[x0][y0]specifies which transform kernels (LFNST kernels) are applied to theLFNST for the current block. st_idx may indicate one of transformkernels in the LFNST transform set which may be detemrnied based onintra/inter prediction and/or block size of the current block.

For example, the intra_mip_flag syntax element may represent informationon whether MIP is applied to luma samples or the current block. Further,for example, the intra_mip_mpm_flag syntax element, theintra_mip_mpm_idx syntax element, or the intra_mip_mpm_remainder syntaxelement may represent information on the intra prediction mode to beapplied to the current block in case that the MIP is applied. Further,for example, the st_idx syntax element may represent information on thetransform kernel (LFNST kernel) to be applied to the LFNST for thecurrent block. That is, the st_idx syntax element may be informationrepresenting one of transform kernels in the LFNST transform set. Here,the st_idx syntax element may be represented as the lfnst_idx syntaxelement or the LFNST index information.

FIG. 10 is a flowchart explaining a method to which MIP and LFNST areapplied.

Meanwhile, another embodiment of the present document may not signalLFNST index information with respect to a block to which MIP is applied.Further, the encoding apparatus may generate a bitstream by encodingimage information excluding the LFNST index information for transform ofthe block to which the MIP is applied, and the decoding apparatus mayparse or decode the bitstream, and may perform a process of transformingthe block without the LFNST index information for transforming the blockto which the MIP is applied.

For example, if the LFNST index information is not signaled, the LFNSTindex information may be induced as a default value. For example, theLFNST index information induced as the default value may be a value of0. For example, the LFNST index information having the value of 0 mayrepresent that the LFNST is not applied to the corresponding block. Inthis case, since the LFNST index information is not transmitted, a bitamount for coding the LFNST index information can be reduced. Further,complexity can be reduced by preventing the MIP and the LFNST from beingsimultaneously applied, and thus latency can also be reduced.

Referring to FIG. 10 , it may be first determined whether the MIP isapplied to the corresponding block. That is, it may be determinedwhether the intra_mip_flag syntax element value is 1 or 0 (S1000). Forexample, if the intra_mip_flag syntax element value is 1, it may beconsidered as true or yes, and it may represent that the MIP is appliedto the corresponding block. Accordingly, the MIP prediction may beperformed for the corresponding block (S1010). That is, the predictionblock for the corresponding block may be derived by performing the MIPprediction. Thereafter, an inverse primary transform procedure may beperformed (S1020), and an intra reconstruction procedure may beperformed (S1030). In other words, a residual block may be derived byperforming the inverse primary transform with respect to transformcoefficients obtained from a bitstream, and a reconstructed block may begenerated based on the prediction block according to the MIP predictionand the residual block. That is, the LFNST index information for theblock to which the MIP is applied may not be included. Further, theLFNST may not be applied to the block to which the MIP is applied.

Further, for example, if the intra_mip_flag syntax element value is 0,it may be considered as false or no, and it may represent that the MIPis not applied to the corresponding block. That is, a conventional intraprediction may be applied to the corresponding block (S1040). That is,the prediction block for the corresponding block may be derived byperforming the conventional intra prediction. Thereafter, it may bedetermined whether the LFNST is applied to the corresponding block basedon the LFNST index information. In other words, it may be determinedwhether the value of the st_idex syntax element is larger than 0(S1050). For example, if the value of the st_idex syntax element islarger than 0, the inverse LFNST transform procedure may be performedusing the transform kernel represented by the st_idex syntax element(S1060). Further, if the value of the st_idex syntax element is notlarger than 0, it may represent that the LFNST is not applied to thecorresponding block, and the inverse LFNST transform procedure may notbe performed. Thereafter, the inverse primary transform procedure may beperformed (S1020), and the intra reconstruction procedure may beperformed (S1030). In other words, the residual block may be derived byperforming the inverse primary transform with respect to the transformcoefficients obtained from the bitstream, and the reconstructed blockmay be generated based on the prediction block according to theconventional intra prediction and the residual block.

In summary, if the MIP is applied, the MIP prediction block may begenerated without decoding the LFNST index information, and the finalintra reconstruction signal may be generated by applying the inverseprimary transform to the received coefficient.

In contrast, if the MIP is not applied, the LFNST index information maybe decoded, and if the value of the flag (or LFNST index information orst_idx syntax element) value is larger than 0, the final intrareconstruction signal may be generated by applying the inverse LFNSTtransform and the inverse primary transform with respect to the receivedcoefficient.

For example, for the above-described procedure, the LFNST indexinformation (or st_idx syntax element) may be included in the syntax orimage information based on the information (or intra_mip_flag syntaxelement) on whether the MIP is applied, and may be signaled. Further,the LFNST index information (or st_idx syntax element) may beselectively configured/parsed/signaled/transmitted/received withreference to the information (or intra_mip_flag syntax element) onwhether the MIP is applied. For example, the LFNST index information maybe represented as the st_idx syntax element or lfnst_idex syntaxelement.

For example, the LFNST index information (or st_idx syntax element) maybe included as in Table 7 below.

TABLE 7 . . .  if( !pcm_flag[ x0 ][ y0 ] ) {   if( CuPredMode[ x0 ][ y0] != MODE_INTRA && merge_flag[ x0 ][ y0 ] = = 0)    cu_cbf ae(v)   if(cu_cbf ) {    if( CuPredMode[ x0 ][ y0] = = MODE_INTER &&sps_sbt_enabled_flag &&     !ciip_flag[ x0 ][ y0 ] ) {     if( cbWidth<= MaxSbtSize && cbHeight <= MaxSbtSize {      allowSbtVerH = cbWidth >=8      allowSbtVerQ = cbWidth >= 16      allowSbtHorH = cbHeight >= 8     allowSbtHorQ = cbHeieht >= 16      if( allowSbfVerH || allowSbtHorH|| allowSbtVerQ || allowSbtHorQ )       cu_sbt_flag ae(v)     }     if(cu_sbt_flag ) {      if( ( allowSbtVerH || allowSbtHorH ) && (allowSbrtVerQ || allowSbtHorQ) )       cu_sbt_quad_flag ae(v)      if( (cu_sbt_quad_flag && allowSbtVerQ && allowSbtHorQ )       (!cu_sbt_quad_flag && allowSbtVerH && allowSbtHorH ) )      cu_sbt_horizontal_flag ae(v)      cu_sbt_pos_flag ae(v)     }    }   numSigCoeff= 0    numZeroOutSigCoeff = 0    transform_tree( x0, y0,cbWidth. cbHeight, treeType )    if( Min( cbWidth, cbHeight ) >= 4 &&sps_st_enabled_flag == 1 &&     CuPredMode[ x0 ][ y0 ] = = MODE INTRA    && IntraSubPartitionsSplitType == ISP_NO_SPLIT     &&!intra_mip_flag [ x0 ][ y0 ] ) {     if( ( nuinSigCoeff > ( ( treeType== SINGLE_TREE ) ? 2 : 1 ) ) &&      numZeroOutSigCoeff == 0 ) {     st_idx[ x0 ][ y0 ] ae(v)     }    }   }  } . . .

For example, referring to Table 7, the st_idx syntax element may beincluded based on the intra_mip_flag syntax element. In other words, ifthe value of the intra_mip_flag syntax element is 0(!intra_mip_flag),the st_idx syntax element may be included.

Further, for example, the LFNST index information (or lfnst_idx syntaxelement) may be included as in Table 8 below.

TABLE 8 if( Min( &1st-Width. lfastHeight ) >= 4 && sps_lIfnst enabledflag = = 1 &&   CuPredMode[ chType ][ x0 ][ y0 ] = = MODE_INTRA &&lfnstNotTsFlag = = 1 &&   ( treeType = = DUAL_TREE_CHROMA ||!intra_mip_flag[ x0 ][ y0 ] ||    Min( lfnstWidth. IfnstHeight ) >= 16 )&&   Max( cbWidth, cbHeight ) <= MaxTbSizeY) {  if( (IntraSubPartitionsSplitType != ISP_NO_SPLIT || LfnstDcOnly = = 0) &&   LfnstZeroOutSigCoeffFlag = = 1) lfnst_idx ae(v) } if( treeType !=DUAL_TREE_CHROMA && lfnst idx = = 0 &&   transform_skip_flag[ x0 ][ y0][ 0 ] = = 0 && Max( cbWidth, cbHeight ) <= 32 &&  IntraSubPartitionsSplitType = = ISP_NO_SPLIT && cu_sbt_flag = = 0 &&  MtsZeroOutSigCoeffFlag = = 1 && MtsDcOnly = = 0 ) {  if( ( (CuPredMode[ chType ][ x0 ][ y0 ] = = MODE_INTER &&   sps_explicit_mts_inter_enabled_flag ) ||    ( CuPredMode[ chType ][x0 ][ y0 ] = = MODE_INTRA &&    sps_explicit_mts_intra_enabled_flag ) ))    mts_idx ae(v) }

For example, referring to Table 8, the lfnst_idx syntax element may beincluded based on the intra_mip_flag syntax element. In other words, ifthe value of the intra_mip_flag syntax element is 0(!intra_mipflag), thelfnst_idx syntax element may be included.

For example, referring to Table 7 or Table 8, the st_idx syntax elementor the lfnst_idx syntax element may be included based on intrasub-partitions (ISP) related information about sub-partitioning of theblock. For example, the ISP related information may include the ISP flagor the ISP partitioning flag, and through this, information on whethersub-partitioning is performed with respect to the block may berepresented. For example, the information on whether thesub-partitioning is performed may be represented asIntraSubPartitionsSplitType, ISP_NO_SPLIT may represent that thesub-partitioning is not performed, ISP_HOR_SPLIT may represent that thesub-partitioning is performed in a horizontal direction, andISP_VER_SPLIT may represent that the sub-partitioning is performed in avertical direction.

The residual related information may include the LFNST index informationbased on the MIP flag and the ISP related information.

Meanwhile, in another embodiment of the present document, the LFNSTindex information may be induced with respect to the block to which theMIP is applied without being separately signaled. Further, the encodingapparatus may generate the bitstream by encoding image informationexcluding the LFNST index information to transform the block to whichthe MIP is applied, and the decoding apparatus may parse or decode thebitstream, induce and obtain the LFNST index information to transformthe block to which the MIP is applied, and perform a process oftransforming the block based on this.

That is, the LFNST index information may not be decoded with respect tothe corresponding block, but through an inducing process, the index forpartitioning the transforms constituting the LFNST transform set may bedetermined. Further, through the inducing process, it may be determinedthat a separate optimized transform kernel is used for the block towhich the MIP is applied. In this case, the optimum LFNST kernel may beselected with respect to the block to which the MIP is applied, and thebit amount for coding this may be reduced.

For example, the LFNST index information may be induced based on atleast one of reference line index information for intra prediction,intra prediction mode information, block size information, or MIPapplication/non-application information.

Meanwhile, in another embodiment of the present document, the LFNSTindex information for the block to which the MIP is applied may bebinarized to be signaled. For example, the number of applicable LFNSTtransforms may differ depending on whether the MIP is applied to thecurrent block, and for this, the binarization method for the LFNST indexinformation may be selectively switched.

For example, one LFNST kernel may be used with respect to the block towhich the MIP is applied, and this kernel may be one of LFNST kernelsbeing applied to the block to which the MIP is not applied. Further, theexisting LFNST kernel having been used may not be used for the block towhich the MIP is applied, but a separate kernel optimized to the blockto which the MIP is applied may be defined and used.

In this case, since a reduced number of LFNST kernels is used withrespect to the block to which the MIP is applied as compared with thatof the block to which the MIP is not applied, overhead due to thesignaling of the LFNST index information may be reduced, and thecomplexity may be reduced.

For example, the LFNST index information may use the binarization methodas in the following table.

TABLE 9 Syntax Binarization structure Syntax element Process Inputparameters . . . . . . . . . st_idx[ ][ ] TR cMax = 2, intra_mip_flag[][ ] == false cRiceParam = 0 st_idx[ ][ ] FL cMax =1 intra_mip_flag[ ][] == true

Referring to Table 9, for example, the st_idx syntax element may bebinarized to truncated rice (TR) in case that the MIP is not applied tothe corresponding block, in case of intra_mip_flag[ ][ ]==false, or incase that the value of the intra_mip_flag syntax element is 0. In thiscase, for example, cMax that is an input parameter may have a value of2, and cRiceParam may have a value of 0.

Further, for example, the st_idx syntax element may be binarized to afixed-length (FL) in case that the MIP is applied to the correspondingblock, in case of intra_mip_flag[ ][ ]==true, or in case that the valueof the intra_mip_flag syntax element is 1. In this case, for example,the cMax that is an input parameter may have a value of 1.

Here, the st_idx syntax element may represent the LFNST indexinformation, and may be represented as the lfnst_idx syntax element.

Meanwhile, in another embodiment of the present document, the LFNSTrelated information may be signaled with respect to the block to whichthe MIP is applied.

For example, the LFNST index information may include one syntax element,and may represent information on whether the LFNST is applied based onone syntax element and information on the kind of the transform kernelbeing used for the LFNST. In this case, the LFNST index information maybe represented as, for example, the st_idx syntax element or thelfnst_idx syntax element.

Further, for example, the LFNST index information may include one ormore syntax elements, and may represent information on whether the LFNSTis applied based on the one or more syntax elements and information onthe kind of the transform kernel being used for the LFNST. For example,the LFNST index information may include two syntax elements. In thiscase, the LFNST index information may include a syntax elementrepresenting information on whether the LFNST is applied and a syntaxelement representing information on the kind of the transform kernelbeing used for the LFNST. For example, the information on whether theLFNST is applied may be represented as an LFNST flag, and may berepresented as an st_flag syntax element or an lfnst_flag syntaxelement. Further, for example, the information on the kind of thetransform kernel being used for the LFNST may be represented as thetransform kernel index flag, and may be represented as an st_idx_flagsyntax element, st_kernel_flag syntax element, lfnst_idx_flag syntaxelement, or lfnst_kernel_flag syntax element. For example, in case thatthe LFNST index information include one or more syntax elements asdescribed above, the LFNST index information may be called LFNST relatedinformation.

For example, the LFNST related information (e.g., st_flag syntax elementor st_idx_flag syntax element) may be included as in Table 10 below.

TABLE 10 . . .  if( !pcm_flag[ x0 ][ y0 ] ) {   if( CuPredMode[ x0 ][ y0] != MODE_INTRA && merge_flag[ x0 [ y0 ] = = 0)    cu_cbf ae(v)   if(cu_cbf ) {    if( CuPredMode[ x0 ][ y0 ] = = MODE_INTER &&sps_sbt_enabled_flag &&     !ciip_flag[ x0 ][ y0 ] ) {     if( cbWidth<= MaxSbtSize && cbHeieht <= MaxSbtSize ) {      allowSbtVerH =cbWidth >= 8      allowSbtVerQ = cbWdth >= 16      allowSbtHotH =cbHeight >= 8      allowSbtflorQ = cbHeight >= 16      if( allowSbtVerH|| allowSbtHorH allowSbtVerQ || allowSbtHorQ )       cu_sbt_flag ae(v)    }     if( cu_sbt_flag ) {      if( ( allowSbtVerH || allowSbtHorH )&& (allowSbtVerQ || allowSbtHorQ) )       cu_sbt_quad_flag ae(v)     if( ( cu_sbt_quad_flag && allowSbtVerQ && allowSbtHorQ ) ||       (!cu_sbt_quad_flag && allowSbtVerH && allowSbtHorH ) )      cu_sbt_horizontal_flag ae(v)      cu_sbt_pos_flag ae(v)     }    }   numSigCoeff = 0    numZeroOutSigCoeff = 0    transform_tree( x0, y0,cbWidth, ebHeight. treeType )    if( Min( cbWidth, cbHeight ) >= 4 &&sps_st_enabled_flag == 1 &&     CuPredMode[ x0 ][ y0 ] = = MODE_INTRA    && IntraSubPartitionsSplitType == ISP_NO_SPLIT ) {     if( (numSigCoeff > ( ( treeType == SINGLE_TREE ) ? 2: 1 ) ) &&     numZeroOutSigCoeff == 0) {      st_flag[ x0 ][ y0 ] ae(v)      if(st_flag[ x0 ][ y0 ] )       st_idx_flag[ x0 ][ y0 ] ae(v)     }    }   } } . . .

Meanwhile, the block to which the MIP is applied may use a differentnumber of LFNST transforms (kernels) from that of the block to which theMIP is not applied. For example, the block to which the MIP is appliedmay use only one LFNST transform kernel. For example, the one LFNSTtransform kernel may be one of LFNST kernels being applied to the blockto which the MIP is not applied. Further, instead of using the existingLFNST kernel having been used with respect to the block to which the MIPis applied. a separate kernel optimized to the block to which the MIP isapplied may be defined and used.

In this case, the information (e.g., transform kernel index flag) on thekind of the transform kernel being used for the LFNST among the LFNSTrelated information may be selectively signaled depending on whether theMIP is applied, and the LFNST related information at this time may beincluded, for example, as in Table 11 below.

TABLE 11 . . .  if( !pcm_ flag[ x0 ][ y0 ] ) {   if( CuPredMode[ x0 ][y0 ] != MODE_INTRA && merge_flag[ x0 ][ y0 ] = = 0)    cu_cbf ae(v)  if( cu_cbf ) {    if( CuPredMode[ x0 ][ y0 ] = = MODE_INTER &&sps_sbt_enabled_flag &&     !ciip_flag[ x0 ][ y0 ]) {     if( cbWidth <=MaxSbtSize && cbHeight <= MaxSbtSize ) {      allowSbtVerH = cbWidth >=8      allowSbtVerQ = cbWidth >= 16      allowSbtHorH = cbHeight >= 8     allowSbtHorQ = cbHeight >= 16      if( allowSbtVerH || allowSbtHorH|| allowSbtVerQ allowSbtHorQ )       cu_sbt_flag ae(v)     }     if(cu_sbt_flag ) {      if( ( allowSbtVerH || allowSbtHorH ) && (allowSbtVerQ || aflowSbtHorQ) )       cu_sbt_quad_flag ae(v)      if( (cu_sbt_quad_flag && allowSbtVerQ && allowSbtHorQ ) || (!cu_sbt_quad_flag && allowSbtVerH && allowSbtHorH ) )      cu_sbt_horizontal_flag ae(v)      cu_sbt_pos_flag ae(v)      }    }     numSigCoeff = 0     numZeroOutSigCoeff = 0     transform_tree(x0, y0, cbWidth, cbHeight, treeType )     if( Min( cbWidth. cbHeight) >= 4 && sps_st_enabled_flag = = 1 &&      CuPredMode[ x0 ][ y0 ] = =MODE_INTRA      && IntraSubPartitionsSplitType == ISP_NO_SPLIT ) {     if( ( numSigCoeff > ( ( treeType == SINGLE_TREE ) ? 2 : 1 ) ) &&      numZeroOutSigCoeff == 0) {       st_flag[ x0 ][ y0 ] ae(v)      if( st_flag[ x0 ][ y0 ] && !intra_mip_flag[ x0 ][ y0 ])       st_idx_flag[ x0 ][ y0 ] ae(v)     }    }   }  } . . .

In other words, referring to Table 11, the information (or st_idx_flagsyntax element) on the kind of the transform kernel being used for theLFNST may be included based on the information (or intra_mip_flag syntaxelement) on whether the MIP has been applied to the corresponding block.Further, for example, the st_idx_flag syntax element may be signaled to!intra_mip_flag in case that the MIP is not applied to the correspondingblock.

For example, in Table 10 or Table 11, information or semanticsrepresented by the st_flag syntax element or the st_idx_flag syntaxelement may be as in the following table.

TABLE 12 st_flag[ x0 ][ y0 ] specifies whether secondary transform isapplied or not. st_flag[ x0 ][ y0 ] equal to 0 specifies that thesecondary transform is not applied. The array indices x0, y0 specify thelocation ( x0, y0 ) of the top-left sample of the considered transformblock relative to the top-left sample of the picture. When st_flag[ x0][ y0 ] is not present, st_idx[ x0 ][ y0 ] is inferred to be equal to 0.st_idx_flag[ x0 ][ y0 ] specifies which secondary transform kernel isapplied between two candidate kernels in a selected transform set. Thearray indices x0, y0 specify the location ( x0, y0 ) of the top-leftsample of the considered transform block relative to the top-left sampleof the picture. When st_idx_flag[ x0 ][ y0 ] is not present, st_idx[ x0][ y0 ] is inferred to be equal to 0.

For example, the st_flag syntax element may represent information onwhether secondary transform is applied. For example, if the value of thest_flag syntax element is 0, it may represent that the secondarytransform is not applied, whereas if 1, it may represent that thesecondary transform is applied. For example, the st_idx_flag syntaxelement may represent information on the applied secondary transformkernel of two candidate kernels in the selected transform set.

For example, for the LFNST related information, a binarization method asin the following table may be used.

TABLE 13 Binarization Syntax structure Syntax element Process Inputparameters . . . . . . . . . st_flag[ ] [ ] FL cMax = 1 st_idx flag[ ] [] FL cMax = 1

Referring to Table 13, for example, the st_flag syntax element may bebinarized to FL. For example, in this case, cMax that is the inputparameter may have a value of 1. Further, for example, the st_idx_flagsyntax element may be binarized to the FL. For example, in this case,the cMax that is the input parameter may have a value of 1.

For example, referring to Table 10 or Table 11, a descriptor of thest_flag syntax element or the st_idx_flag syntax element may be ae(v).Here, ae(v) may represent context-adaptive arithmetic entropy-coding.Further, the syntax element of which the descriptor is ae(v) may becontext-adaptive arithmetic entropy-coded syntax element. That is, thecontext-adaptive arithmetic entropy-coding may be applied to the LFNSTrelated information (e.g., st_flag syntax element or st_idx_flag syntaxelement). Further, the LFNST related information (e.g., st_flag syntaxelement or st_idx_flag syntax element) may be information or a syntaxelement to which the context-adaptive arithmetic entropy-coding isapplied. Further, the LFNST related information (e.g., bins of a binstring of the st_flag syntax element or the st_idx_flag syntax element)may be encoded/decoded based on the above-described CABAC and the like.Here, the context-adaptive arithmetic entropy-coding may be representedas context model based coding, context coding, or regular coding.

For example, context index increment (ctxInc) of the LFNST relatedinformation (e.g., st_flag syntax element or st_idx_flag syntax element)or ctxInc in accordance with the bin location of the st_flag syntaxelement or the st_idx_flag syntax element may be allocated or determinedas in Table 14. Further, as in Table 14, a context model may be selectedbased on the ctxInc in accordance with the bin location of the st_flagsyntax element or the st_idx_flag syntax element that is allocated ordetermined as in Table 14.

TABLE 14 binIdx Syntax element 0 1 2 3 4 >=5 ... ... ... ... ... ... ...st_flag[ ][ ] 0, 1 na na na na na (clause 9.5.4.2.8) st_idx_flag[ ][ ]bypass na na na na na

Referring to Table 14, for example, (the bin of the bin string or thefirst bin of) the st_flag syntax element may use two context models (orctxIdx), and a context model may be selected based on the ctxInc havinga value of 0 or 1. Further, for example, bypass coding may be applied to(the bin of the bin string or the first bin of) the st_idx_flag syntaxelement. Further, the coding may be performed by applying a regularprobability distribution.

For example, the ctxInc of (the bin of the bin string or the first binof) the st_flag syntax element may be determined based on Table 15below.

TABLE 15 9.5.4.2.8  Derivation process of ctxInc for the syntax elementst_flag Inputs to this process are the colour component index cIdx. theluma or chroma location ( x0, y0 ) specifying the top-left sample of thecurrent luma or chroma coding block relative to the top-left sample ofthe current picture depending on cIdx, the tree type treeType and themultiple transform selection index tu_mts_idx[ x0 ][ y0 ]. Output ofthis process is ctxInc. The assignment of ctxInc is specified asfollows:  ctxInc = ( tu_mts_idx[ x0 ][ y0 ] == 0 && treeType != SINGLE_TREE ) ? 1 : 0

Referring to Table 15, for example, the ctxInc of (the bin of the binstring or the first bin of) the st_flag syntax element may be determinedbased on an MTS index (or tu_mts_idx syntax element) or tree typeinformation (treeType). For example, the ctxInc may be derived as 1 incase that the value of the MTS index is 0 and the tree type is not asingle tree. Further, the ctxInc may be derived as 0 in case that thevalue of the MTS index is not 0 or the tree type is the single tree.

In this case, since a reduced number of LFNST kernels is used withrespect to the block to which the MIP is applied as compared with thatof to which the MIP is not applied, overhead due to the signaling of theLFNST index information may be reduced, and the complexity may bereduced.

Meanwhile, in another embodiment of the present document, the LFNSTkernel may be induced and used with respect to the block to which theMIP is applied. That is, the LFNST kernel may be induced withoutseparately signaling information on the LFNST kernel. Further, theencoding apparatus may generate the bitstream by encoding imageinformation excluding the LFNST index information to transform the blockto which the MIP is applied and information on (the kind of) thetransform kernel being sued for the LFNST, and the decoding apparatusmay parse or decode the bitstream, induce and obtain the LFNST indexinformation to transform the block to which the MIP is applied and theinformation on the transform kernel being used for the LFNST, andperform a process of transforming the block based on this.

That is, the LFNST index information for the corresponding block orinformation on the transform kernel used for the LFNST may not bedecoded, but through an inducing process, the index for partitioning thetransforms constituting the LFNST transform set may be determined.Further, through the inducing process, it may be determined that aseparate optimized transform kernel is used for the block to which theMIP is applied. In this case, the optimum LFNST kernel may be selectedwith respect to the block to which the MIP is applied, and the bitamount for coding this may be reduced.

For example, the LFNST index information or the information on thetransform kernel being used for the LFNST may be induced based on atleast one of reference line index information for intra prediction,intra prediction mode information, block size information, or MIPapplication/non-application information.

In the above-described embodiments of the present document, fixed-length(FL) binarization may represent a binarization method with a fixedlength such as a specific number of bits, and the specific number ofbits may be predefined, or may be represented based on the cMax.Truncated unary (TU) binarization may represent a binarization methodwith a variable length without appending 0 in case that the number ofsymbols, being intended to express using 1 of which the number is asmany as the number of symbols and one 0, is equal to the maximum length,and the maximum length may be represented based on the cMax. Truncatedrice (TR) binarization may represent a binarization method in the formin which prefix and suffix are connected to each other, such as TU+FL,using the maximum length and shift information, and in case that theshift information has a value of 0, it may be equal to the TU. Here, themaximum length may be represented based on the cMax, and the shiftinformation may be represented based on cRiceParam.

FIGS. 11 and 12 schematically illustrate a video/image encoding methodand an example of related components according to embodiment(s) of thepresent document.

The method disclosed in FIG. 11 may be performed by an encodingapparatus disclosed in FIG. 2 or FIG. 12 . Specifically, for example,S1100 to S1120 of FIG. 11 may be performed by the predictor 220 of theencoding apparatus of FIG. 12 , and S1130 to S1150 of FIG. 11 may beperformed by the residual processor 230 of the encoding apparatus ofFIG. 12 , and S1160 of FIG. 11 may be performed by the entropy encoder240 of the encoding apparatus of FIG. 12 . Further, although notillustrated in FIG. 11 , the predictor 220 of the encoding apparatus inFIG. 12 may derive prediction samples or prediction related information,the residual processor 230 of the encoding apparatus may derive residualinformation from the original samples or prediction samples, and theentropy encoder 240 of the encoding apparatus may generate a bitstreamfrom the residual information or the prediction related information. Themethod disclosed in FIG. 11 may include the above-described embodimentsof the present document.

Referring to FIG. 11 , the encoding apparatus may determine an intraprediction type of the current block (S1100), and may generate intraprediction type information for the current block based on the intraprediction type (S1110). For example, the encoding apparatus maydetermine the intra prediction type of the current block inconsideration of a rate distortion (RD) cost. The intra prediction typeinformation may represent information on whether to apply a normal intraprediction type using a reference line adjacent to the current block,multi-reference line (MRL) using a reference line that is not adjacentto the current block, intra sub-partitions (ISP) performingsub-partitioning for the current block, or matrix based intra prediction(MIP) using a matrix.

For example, the intra prediction type information may include an MIPflag representing whether the MIP is applied to the current block.Further, for example, the intra prediction type information may includeintra sub-partitions (ISP) related information on sub-partitioning ofISP for the current block. For example, the ISP related information mayinclude an ISP flag representing whether the ISP is applied to thecurrent block or an ISP partitioning flag representing a partitioningdirection. Further, for example, the intra prediction type informationmay include the MIP flag and the ISP related information. For example,the MIP flag may represent an intra_mip_flag syntax element. Further,for example, the ISP flag may represent an intra_subpartitions_mode_flagsyntax element, and the ISP partitioning flag may represent anintra_subpartitions_split_flag syntax element.

Further, although not illustrated in FIG. 11 , for example, the encodingapparatus may determine the intra prediction mode for the current block,and may generate intra prediction information for the current blockbased on the intra prediction mode. For example, the encoding apparatusmay determine the intra prediction mode in consideration of the RD cost.The intra prediction mode information may represent the intra predictionmode to be applied to the current block among the intra predictionmodes. For example, the intra prediction modes may include No. 0 to No.66 intra prediction modes. For example, No. 0 intra prediction mode mayrepresent a planar mode, and No. 1 intra prediction mode may represent aDC mode. Further, No. 2 to No. 66 intra prediction modes may berepresented as directional or angular intra prediction modes, and mayrepresent directions to be referred to. Further, No. 0 and No. 1 intraprediction modes may be represented as non-directional or non-angularintra prediction modes. The detailed explanation thereof has been madewith reference to FIG. 5 .

For example, the encoding apparatus may generate prediction relatedinformation for the current block, and the prediction relatedinformation may include intra prediction mode information and/or intraprediction type information.

The encoding apparatus may derive prediction samples of the currentblock based on the intra prediction type (S1120). Further, for example,the encoding apparatus may generate the prediction samples based on theintra prediction mode and/or the intra prediction type. Further, theencoding apparatus may generate the prediction samples based on theprediction related information.

The encoding apparatus may generate residual samples of the currentblock based on the prediction samples (S1130). For example, the encodingapparatus may generate the residual samples based on the originalsamples (e.g., input image signal) and the prediction samples. Further,for example, the encoding apparatus may generate the residual samplesbased on a difference between the original samples and the predictionsamples.

The encoding apparatus may derive transform coefficients for the currentblock based on the residual samples (S1140). For example, the encodingapparatus may derive the transform coefficients by performing primarytransform based on the residual samples. Further, for example, theencoding apparatus may derive temporary transform coefficients byperforming the primary transform based on the residual samples, and mayderive the transform coefficients by applying the LFNST to the temporarytransform coefficients. For example, in case that the LFNST is applied,the encoding apparatus may generate the LFNST index information. Thatis, the encoding apparatus may generate the LFNST index informationbased on the transform kernel used to derive the transform coefficients.

The encoding apparatus may generate residual related information basedon the transform coefficients (S1150). For example, the encodingapparatus may derive quantized transform coefficients by performingquantization based on the transform coefficients. Further, the encodingapparatus may generate information on the quantized transformcoefficients based on the quantized transform coefficients. Further, theresidual related information may include information on the quantizedtransform coefficients.

The encoding apparatus may encode the intra prediction type informationand the residual related information (S1160). For example, the residualrelated information may include the information on the quantizedtransform coefficients as described above. Further, for example, theresidual related information may include the LFNST index information.Further, for example, the residual related information may not includethe LFNST index information.

For example, the residual related information may include the LFNSTindex information representing information on a non-separable transformfor low-frequency transform coefficients of the current block. Further,for example, the residual related information may include the LFNSTindex information based on the MIP flag or the size of the currentblock. Further, for example, the residual related information mayinclude the LFNST index information based on the MIP flag or theinformation on the current block. Here, the information on the currentblock may include at least one of the size of the current block, treestructure information representing a single tree or a dual tree, anLFNST enabled flag or ISP related information. For example, the MIP flagmay be one of a plurality of conditions for determining whether theresidual related information includes the LFNST index information, andby other conditions, such as the size of the current block, in additionto the MIP flag, the residual related information may include the LFNSTindex information. However, hereinafter, explanation will be made aroundthe MIP flag. Here, the LFNST index information may be represented astransform index information. Further, the LFNST index information may berepresented as the st_idx syntax element or the lfnst_idx syntaxelement.

For example, the residual related information may include the LFNSTindex information based on the MIP flag representing that the MIP is notapplied. Further, for example, the residual related information may notinclude the LFNST index information based on the MIP flag representingthat the MIP is applied. That is, in case that the MIP flag representsthat the MIP is applied to the current block (e.g., in case that thevalue of the intra_mip_flag syntax element is 1), the residual relatedinformation may not include the LFNST index information, and in casethat the MIP flag represent that the MIP is not applied to the currentblock (e.g., in case that the value of the intra_mip_flag syntax elementis 0), the residual related information may include the LFNST indexinformation.

Further, for example, the residual related information may include theLFNST index information based on the MIP flag and the ISP relatedinformation. For example, in case that the MIP flag represents that theMIP is not applied to the current block (e.g., in case that the value ofthe intra_mip_flag syntax element is 0), the residual relatedinformation may include the LFNST index information with reference tothe ISP related information (IntraSubPartitionsSplitType). Here, theIntraSubPartitionsSplitType may represent that the ISP is not applied(ISP_NO_SPLIT), the ISP is applied in a horizontal direction(ISP_HOR_SPLIT), or the ISP is applied in a vertical direction(ISP_VER_SPLIT), and this may be derived based on the ISP flag or theISP partitioning flag.

For example, as the MIP flag represents that the MIP is applied to thecurrent block, the LFNST index information may be induced or derived tobe used, and in this case, the residual related information may notinclude the LFNST index information. That is, the encoding apparatus maynot signal the LFNST index information. For example, the LFNST indexinformation may be induced or derived to be used based on at least oneof reference line index information for the current block, intraprediction mode information of the current block, size information ofthe current block, and the MIP flag.

Further, for example, the LFNST index information may include an LFNSTflag representing whether non-separable transform for the low-frequencytransform coefficients of the current block is applied and/or atransform kernel index flag representing the transform kernel applied tothe current block among transform kernel candidates. That is, althoughthe LFNST index information may represent the information on thenon-separable transform for the low-frequency transform coefficients ofthe current block based on one syntax element or one piece ofinformation, it may also represent the information based on two syntaxelements or two pieces of information. For example, the LFNST flag maybe represented as the st_flag syntax element or the lfnst_flag syntaxelement, and the transform kernel index flag may be represented as thest_idx_flag syntax element, the st_kernel_flag syntax element, thelfnst_idx_flag syntax element, or the lfnst_kernel_flag syntax element.Here, the transform kernel index flag may be included in the LFNST indexinformation based on the LFNST flag representing that the non-separabletransform is applied and the MIP flag representing that the MIP is notapplied. That is, in case that the LFNST flag represents that thenon-separable transform is applied and the MIP flag represents that theMIP is applied, the LFNST index information may include the transformkernel index flag.

For example, as the MIP flag represents that the MIP is applied to thecurrent block, the LFNST flag and the transform kernel index flag may beinduced or derived to be used, and in this case, the residual relatedinformation may not include the LFNST flag and the transform kernelindex flag. That is, the encoding apparatus may not signal the LFNSTflag and the transform kernel index flag. For example, the LFNST flagand the transform kernel index flag may be induced or derived to be usedbased on at least one of reference line index information for thecurrent block, intra prediction mode information of the current block,size information of the current block, and the MIP flag.

For example, in case that the residual related information includes theLFNST index information, the LFNST index information may be representedthrough binarization. For example, the LFNST index information (e.g.,st_idx syntax element or lfnst_idx syntax element) may be representedthrough truncated rice (TR) based binarization based on the MIP flagrepresenting that the MIP is not applied, and the LFNST indexinformation (e.g., st_idx syntax element or lfnst_idx syntax element)may be represented through fixed length (FL) based binarization based onthe MIP flag representing that the MIP is applied. That is, in case thatthe MIP flag represents that the MIP is not applied to the current block(e.g., in case that the intra_mip_flag syntax element is 0 or false),the LFNST index information (e.g., st_idx syntax element or lfnst_idxsyntax element) may be represented through the TR based binarization,and in case that the MIP flag represents that the MIP is applied to thecurrent block (e.g., in case that the intra_mip_flag syntax element is 1or true), the LFNST index information (e.g., st_idx syntax element orlfnst_idx syntax element) may be represented through the FL basedbinarization.

Further, for example, in case that the residual related informationincludes the LFNST index information, and the LFNST index informationincludes the LFNST flag and the transform kernel index flag, the LFNSTflag and the transform kernel index flag may be represented through thefixed length (FL) based binarization.

For example, the LFNST index information may be represented as (a binof) a bind string through the above-described binarization, and bycoding this, a bit, a bit string, or a bitstream may be generated.

For example, (the first) bin of the bin string of the LFNST flag may becoded based on context coding, and the context coding may be performedbased on the value of context index increment for the LFNST flag. Here,the context coding Is a coding being performed based on a context model,and may be called a regular coding. Further, the context model may berepresented by the context index ctsIdx, and the context index may berepresented based on the context index increment ctxInc and contextindex offset ctxIdxOffset. For example, the value of the context indexincrement may be represented as one of candidates including 0 and 1. Forexample, the value of the context index increment may be determinedbased on the MTS index (e.g., mts_idx syntax element or tu_mts_idxsyntax element) representing the transform kernel set to be used for thecurrent block among the transform kernel sets and the tree typeinformation representing the partitioning structure of the currentblock. Here, the tree type information may represent a single treerepresenting that partitioning structures of the luma component and thechroma component of the current block are equal to each other or a dualtree representing that the partitioning structures of the luma componentand the chroma component of the current block are different from eachother.

For example, (the first) bin of the bin string of the transform kernelindex flag may be coded based on bypass coding. Here, the bypass codingmay represent that the context coding is performed based on the regularprobability distribution, and the coding efficiency can be enhancedthrough omission of the context coding update procedure.

Further, although not illustrated in FIG. 11 , for example, the encodingapparatus may generate reconstructed samples based on the residualsamples and the prediction samples. Further, a reconstructed block and areconstructed picture may be derived based on the reconstructed samples.

For example, the encoding apparatus may generate the bitstream orencoded information by encoding image information including all or partsof the above-described pieces of information (or syntax elements).Further, the encoding apparatus may output the information in the formof a bitstream. Further, the bitstream or the encoded information may betransmitted to the decoding apparatus through a network or a storagemedium. Further, the bitstream or the encoded information may be storedin a computer readable storage medium, and the bitstream or the encodedinformation may be generated by the above-described image encodingmethod.

FIGS. 13 and 14 schematically illustrate a video/image decoding methodand an example of related components according to embodiment(s) of thepresent document.

The method disclosed in FIG. 13 may be performed by a decoding apparatusdisclosed in FIG. 3 or FIG. 14 . Specifically, for example, S1300 ofFIG. 13 may be performed by the entropy decoder 310 of the decodingapparatus of FIG. 14 , and S1310 and S1320 of FIG. 13 may be performedby the residual processor 320 of the decoding apparatus of FIG. 14 .Further, although not illustrated in FIG. 13 , the entropy decoder 310of the decoding apparatus of FIG. 14 may derive prediction relatedinformation or residual information from the bitstream, the residualprocessor 320 of the decoding apparatus may derive residual samples fromthe residual information, the predictor 330 of the decoding apparatusmay derive prediction samples from the prediction related information,and the adder 340 of the decoding apparatus may derive a reconstructedblock or a reconstructed picture from the residual samples or theprediction samples. The method disclosed in FIG. 13 may include theabove-described embodiments of the present document.

Referring to FIG. 13 , the decoding apparatus may obtain intraprediction type information for the current block and residual relatedinformation from the bitstream (S1300). For example, the decodingapparatus may obtain the intra prediction type information or residualrelated information by parsing or decoding the bitstream. Here, thebitstream may be called encoded (image) information.

For example, the decoding apparatus may obtain prediction relatedinformation from the bitstream, and the prediction related informationmay include intra prediction mode information and/or intra predictiontype information. For example, the decoding apparatus may generateprediction samples for the current block.

The intra prediction mode information may represent the intra predictionmode to be applied to the current block among the intra predictionmodes. For example, the intra prediction modes may include No. 0 to No.66 intra prediction modes. For example, No. 0 intra prediction mode mayrepresent a planar mode, and No. 1 intra prediction mode may represent aDC mode. Further, No. 2 to No. 66 intra prediction modes may berepresented as directional or angular intra prediction modes, and mayrepresent directions to be referred to. Further, No. 0 and No. 1 intraprediction modes may be represented as non-directional or non-angularintra prediction modes. The detailed explanation thereof has been madewith reference to FIG. 5 .

Further, the intra prediction type information may represent informationon whether to apply a normal intra prediction type using a referenceline adjacent to the current block, multi-reference line (MRL) using areference line that is not adjacent to the current block, intrasub-partitions (ISP) performing sub-partitioning for the current block,or matrix based intra prediction (MIP) using a matrix.

For example, the decoding apparatus may obtain residual relatedinformation from the bitstream. Here, the residual related informationmay represent information being used to derive residual samples, and mayinclude information on the residual samples, (inverse) transform relatedinformation, and/or (inverse) quantization related information. Forexample, the residual related information may include information onquantized transform coefficients.

For example, the intra prediction type information may include an MIPflag representing whether the MIP is applied to the current block.Further, for example, the intra prediction type information may includeintra sub-partitions (ISP) related information on sub-partitioning ofISP for the current block. For example, the ISP related information mayinclude an ISP flag representing whether the ISP is applied to thecurrent block or an ISP partitioning flag representing a partitioningdirection. Further, for example, the intra prediction type informationmay include the MIP flag and the ISP related information. For example,the MIP flag may represent an intra_mip_flag syntax element. Further,for example, the ISP flag may represent an intra_subpartitions_mode_flagsyntax element, and the ISP partitioning flag may represent anintra_subpartitions_split_flag syntax element.

For example, the residual related information may include thelow-frequency non-separable transform (LFNST) index informationrepresenting information on a non-separable transform for low-frequencytransform coefficients of the current block. Further, for example, theresidual related information may include the LFNST index informationbased on the MIP flag or the size of the current block. Further, forexample, the residual related information may include the LFNST indexinformation based on the MIP flag or the information on the currentblock. Here, the information on the current block may include at leastone of the size of the current block, tree structure informationrepresenting a single tree or a dual tree, an LFNST enabled flag or ISPrelated information. For example, the MIP flag may be one of a pluralityof conditions for determining whether the residual related informationincludes the LFNST index information, and by other conditions, such asthe size of the current block, in addition to the MIP flag, the residualrelated information may include the LFNST index information. However,hereinafter, explanation will be made around the MIP flag. Here, theLFNST index information may be represented as transform indexinformation. Further, the LFNST index information may be represented asthe st_idx syntax element or the lfnst_idx syntax element.

For example, the residual related information may include the LFNSTindex information based on the MIP flag representing that the MIP is notapplied. Further, for example, the residual related information may notinclude the LFNST index information based on the MIP flag representingthat the MIP is applied. That is, in case that the MIP flag representsthat the MIP is applied to the current block (e.g., in case that thevalue of the intra_mip_flag syntax element is 1), the residual relatedinformation may not include the LFNST index information, and in casethat the MIP flag represent that the MIP is not applied to the currentblock (e.g., in case that the value of the intra_mip_flag syntax elementis 0), the residual related information may include the LFNST indexinformation.

Further, for example, the residual related information may include theLFNST index information based on the MIP flag and the ISP relatedinformation. For example, in case that the MIP flag represents that theMIP is not applied to the current block (e.g., in case that the value ofthe intra_mip_flag syntax element is 0), the residual relatedinformation may include the LFNST index information with reference tothe ISP related information (IntraSubPartitionsSplitType). Here, theIntraSubPartitionsSplitType may represent that the ISP is not applied(ISP_NO_SPLIT), the ISP is applied in a horizontal direction(ISP_HOR_SPLIT), or the ISP is applied in a vertical direction(ISP_VER_SPLIT), and this may be derived based on the ISP flag or theISP partitioning flag.

For example, as the MIP flag represents that the MIP is applied to thecurrent block, the LFNST index information may be induced or derived tobe used in case that the residual related information does not includethe LFNST index information, that is, in case that the LFNST indexinformation is not signaled. For example, the LFNST index informationmay be derived based on at least one of reference line index informationfor the current block, intra prediction mode information of the currentblock, size information of the current block, and the MIP flag.

Further, for example, the LFNST index information may include an LFNSTflag representing whether non-separable transform for the low-frequencytransform coefficients of the current block is applied and/or atransform kernel index flag representing the transform kernel applied tothe current block among transform kernel candidates. That is, althoughthe LFNST index information may represent the information on thenon-separable transform for the low-frequency transform coefficients ofthe current block based on one syntax element or one piece ofinformation, it may also represent the information based on two syntaxelements or two pieces of information. For example, the LFNST flag maybe represented as the st_flag syntax element or the lfnst_flag syntaxelement, and the transform kernel index flag may be represented as thest_idx_flag syntax element, the st_kernel_flag syntax element, thelfnst_idx_flag syntax element, or the lfnst_kernel_flag syntax element.Here, the transform kernel index flag may be included in the LFNST indexinformation based on the LFNST flag representing that the non-separabletransform is applied and the MIP flag representing that the MIP is notapplied. That is, in case that the LFNST flag represents that thenon-separable transform is applied and the MIP flag represents that theMIP is applied, the LFNST index information may include the transformkernel index flag.

For example, as the MIP flag represents that the MIP is applied to thecurrent block, the LFNST flag and the transform kernel index flag may beinduced or derived in case that the residual related information doesnot include the LFNST flag and the transform kernel index flag, that is,the LFNST flag and the transform kernel index flag are not signaled. Forexample, the LFNST flag and the transform kernel index flag may bederived based on at least one of reference line index information forthe current block, intra prediction mode information of the currentblock, size information of the current block, and the MIP flag.

For example, in case that the residual related information includes theLFNST index information, the LFNST index information may be representedthrough binarization. For example, the LFNST index information (e.g.,st_idx syntax element or lfnst_idx syntax element) may be derivedthrough truncated rice (TR) based binarization based on the MIP flagrepresenting that the MIP is not applied, and the LFNST indexinformation (e.g., st_idx syntax element or lfnst_idx syntax element)may be derived through fixed length (FL) based binarization based on theMIP flag representing that the MIP is applied. That is, in case that theMIP flag represents that the MIP is not applied to the current block(e.g., in case that the intra_mip_flag syntax element is 0 or false),the LFNST index information (e.g., st_idx syntax element or lfnst_idxsyntax element) may be derived through the TR based binarization, and incase that the MIP flag represents that the MIP is applied to the currentblock (e.g., in case that the intra_mip_flag syntax element is 1 ortrue), the LFNST index information (e.g., st_idx syntax element orlfnst_idx_syntax element) may be derived through the FL basedbinarization.

Further, for example, in case that the residual related informationincludes the LFNST index information, and the LFNST index informationincludes the LFNST flag and the transform kernel index flag, the LFNSTflag and the transform kernel index flag may be derived through thefixed length (FL) based binarization.

For example, the LFNST index information may derive candidates throughthe above-described binarization, may compare bins represented byparsing or decoding the bitstream with the candidates, and through this,the LFNST index information may be obtained.

For example, (the first) bin of the bin string of the LFNST flag may bederived based on context coding, and the context coding may be performedbased on the value of context index increment for the LFNST flag. Here,the context coding is a coding being performed based on the contextmodel, and may be called a regular coding. Further, the context modelmay be represented by the context index ctsIdx, and the context indexmay be derived based on the context index increment ctxInc and contextindex offset ctxIdxOffset. For example, the value of the context indexincrement may be derived as one of candidates including 0 and 1. Forexample, the value of the context index increment may be derived basedon the MTS index (e.g., mts_idx syntax element or to mts_idx syntaxelement) representing the transform kernel set to be used for thecurrent block among the transform kernel sets and the tree typeinformation representing the partitioning structure of the currentblock. Here, the tree type information may represent a single treerepresenting that partitioning structures of the luma component and thechroma component of the current block are equal to each other or a dualtree representing that the partitioning structures of the luma componentand the chroma component of the current block are different from eachother.

For example, (the first) bin of the bin string of the transform kernelindex flag may be derived based on bypass coding. Here, the bypasscoding may represent that the context coding is performed based on theregular probability distribution, and the coding efficiency can beenhanced through omission of the context coding update procedure.

The decoding apparatus may derive transform coefficients for the currentblock based on the residual related information (S1310). For example,the residual related information may include information on thequantized transform coefficients, and the decoding apparatus may derivethe quantized transform coefficients for the current block based on theinformation on the quantized transform coefficients. For example, thedecoding apparatus may derive the transform coefficients for the currentblock by performing dequantization of the quantized transformcoefficients.

The decoding apparatus may generate the residual samples of the currentblock based on the transform coefficients (S1320). For example, thedecoding apparatus may generate the residual samples from the transformcoefficients based on the LFNST index information. For example, in casethat the LFNST index information is included in the residual relatedinformation or the LFNST index information is induced or derived, theLFNST may be performed with respect to the transform coefficients inaccordance with the LFNST index information, and modified transformcoefficients may be derived. Thereafter, the decoding apparatus maygenerate the residual samples based on the modified transformcoefficients. Further, for example, in case that the LFNST indexinformation is not included in the residual related information or it isrepresented that the LFNST is not performed, the decoding apparatus maynot perform the LFNST with respect to the transform coefficients, butmay generate the residual samples based on the transform coefficients.

Although not illustrated in FIG. 13 , for example, the decodingapparatus may generate the reconstructed samples based on the predictionsamples and the residual samples. Further, for example, thereconstructed block and the reconstructed picture may be derived basedon the reconstructed samples.

For example, the decoding apparatus may obtain image informationincluding all or parts of the above-described pieces of information (orsyntax elements) by decoding the bitstream or the encoded information.Further, the bitstream or the encoded information may be stored in acomputer readable storage medium, and may cause the above-describeddecoding method to be performed.

Although methods have been described on the basis of a flowchart inwhich steps or blocks are listed in sequence in the above-describedembodiments, the steps of the present document are not limited to acertain order, and a certain step may be performed in a different stepor in a different order or concurrently with respect to that describedabove. Further, it will be understood by those ordinary skilled in theart that the steps of the flowcharts are not exclusive, and another stepmay be included therein or one or more steps in the flowchart may bedeleted without exerting an influence on the scope of the presentdisclosure.

The aforementioned method according to the present disclosure may be inthe form of software, and the encoding apparatus and/or decodingapparatus according to the present disclosure may be included in adevice for performing image processing, for example, a TV, a computer, asmart phone, a set-top box, a display device, or the like.

When the embodiments of the present disclosure are implemented bysoftware, the aforementioned method may be implemented by a module(process or function) which performs the aforementioned function. Themodule may be stored in a memory and executed by a processor. The memorymay be installed inside or outside the processor and may be connected tothe processor via various well-known means. The processor may includeApplication-Specific Integrated Circuit (ASIC), other chipsets, alogical circuit, and/or a data processing device. The memory may includea Read-Only Memory (ROM), a Random Access Memory (RAM), a flash memory,a memory card, a storage medium, and/or other storage device. In otherwords, the embodiments according to the present disclosure may beimplemented and executed on a processor, a micro-processor, acontroller, or a chip. For example, functional units illustrated in therespective figures may be implemented and executed on a computer, aprocessor, a microprocessor, a controller, or a chip. In this case,information on implementation (for example, information on instructions)or algorithms may be stored in a digital storage medium.

In addition, the decoding apparatus and the encoding apparatus to whichthe embodiment(s) of the present document is applied may be included ina multimedia broadcasting transceiver, a mobile communication terminal,a home cinema video device, a digital cinema video device, asurveillance camera, a video chat device, and a real time communicationdevice such as video communication, a mobile streaming device, a storagemedium, a camcorder, a video on demand (VoD) service provider, an OverThe Top (OTT) video device, an internet streaming service provider, a 3Dvideo device, a Virtual Reality (VR) device, an Augment Reality (AR)device, an image telephone video device, a vehicle terminal (forexample, a vehicle (including an autonomous vehicle) terminal, anairplane terminal, or a ship terminal), and a medical video device; andmay be used to process an image signal or data. For example, the OTTvideo device may include a game console, a Bluray player, anInternet-connected TV, a home theater system, a smartphone, a tablet PC,and a Digital Video Recorder (DVR).

In addition, the processing method to which the embodiment(s) of thepresent document is applied may be produced in the form of a programexecuted by a computer and may be stored in a computer-readablerecording medium. Multimedia data having a data structure according tothe embodiment(s) of the present document may also be stored in thecomputer-readable recording medium. The computer readable recordingmedium includes all kinds of storage devices and distributed storagedevices in which computer readable data is stored. The computer-readablerecording medium may include, for example, a Bluray disc (BD), auniversal serial bus (USB), a ROM, a PROM, an EPROM, an EEPROM, a RAM, aCD-ROM, a magnetic tape, a floppy disk, and an optical data storagedevice. The computer-readable recording medium also includes mediaembodied in the form of a carrier wave (for example, transmission overthe Internet). In addition, a bitstream generated by the encoding methodmay be stored in the computer-readable recording medium or transmittedthrough a wired or wireless communication network.

In addition, the embodiment(s) of the present document may be embodiedas a computer program product based on a program code, and the programcode may be executed on a computer according to the embodiment(s) of thepresent document. The program code may be stored on a computer-readablecarrier.

FIG. 15 represents an example of a contents streaming system to whichthe embodiment of the present document may be applied.

Referring to FIG. 15 , the content streaming system to which theembodiments of the present document is applied may generally include anencoding server, a streaming server, a web server, a media storage, auser device, and a multimedia input device.

The encoding server functions to compress to digital data the contentsinput from the multimedia input devices, such as the smart phone, thecamera, the camcorder and the like, to generate a bitstream, and totransmit it to the streaming server. As another example, in a case wherethe multimedia input device, such as, the smart phone, the camera, thecamcorder or the like, directly generates a bitstream, the encodingserver may be omitted.

The bitstream may be generated by an encoding method or a bitstreamgeneration method to which the embodiments of the present document isapplied. And the streaming server may temporarily store the bitstream ina process of transmitting or receiving the bitstream.

The streaming server transmits multimedia data to the user equipment onthe basis of a user's request through the web server, which functions asan instrument that informs a user of what service there is. When theuser requests a service which the user wants, the web server transfersthe request to the streaming server, and the streaming server transmitsmultimedia data to the user. In this regard, the contents streamingsystem may include a separate control server, and in this case, thecontrol server functions to control commands/responses betweenrespective equipment in the content streaming system.

The streaming server may receive contents from the media storage and/orthe encoding server. For example, in a case the contents are receivedfrom the encoding server, the contents may be received in real time. Inthis case, the streaming server may store the bitstream for apredetermined period of time to provide the streaming service smoothly.

For example, the user equipment may include a mobile phone, a smartphone, a laptop computer, a digital broadcasting terminal, a personaldigital assistant (PDA), a portable multimedia player (PMP), anavigation, a slate PC, a tablet PC, an ultrabook, a wearable device(e.g., a watch-type terminal (smart watch), a glass-type terminal (smartglass), a head mounted display (HMD)), a digital TV, a desktop computer,a digital signage or the like.

Each of servers in the contents streaming system may be operated as adistributed server, and in this case, data received by each server maybe processed in distributed manner.

Claims in the present description can be combined in a various way. Forexample, technical features in method claims of the present descriptioncan be combined to be implemented or performed in an apparatus, andtechnical features in apparatus claims can be combined to be implementedor performed in a method. Further, technical features in method claim(s)and apparatus claim(s) can be combined to be implemented or performed inan apparatus. Further, technical features in method claim(s) andapparatus claim(s) can be combined to be implemented or performed in amethod.

What is claimed is:
 1. An image decoding method performed by a decodingapparatus, the method comprising: obtaining intra prediction typeinformation and residual related information for a current block from abitstream; deriving transform coefficients for the current block basedon information on quantized transform coefficients included in theresidual related information; and generating residual samples of thecurrent block based on the transform coefficients, wherein the intraprediction type information includes a matrix based intra prediction(MIP) flag representing whether MIP is applied to the current block,wherein the residual related information includes low frequencynon-separable transform (LFNST) index information for the current blockbased on the MIP flag, wherein the residual samples are generated fromthe transform coefficients based on the LFNST index information, whereina parsing order of the MIP flag is prior to a parsing order of the LFNSTindex information, wherein based on a value of the MIP flag being notequal to 1, the residual related information includes the LFNST indexinformation, and wherein the LFNST index information is configured in acoding unit syntax based on the MIP flag.
 2. The image decoding methodof claim 1, wherein the residual related information does not includethe LFNST index information based on the value of the MIP flag beingequal to 1, and wherein the LFNST index information is derived based onat least one of reference line index information for the current block,intra prediction mode information of the current block, size informationof the current block, or the MIP flag.
 3. The image decoding method ofclaim 1, wherein the LFNST index information is derived throughtruncated rice (TR) based binarization.
 4. The image decoding method ofclaim 1, wherein the LFNST index information comprises an LFNST flagrepresenting whether a non-separable transform for low-frequencytransform coefficients of the current block is applied, and a transformkernel index flag representing a transform kernel applied to the currentblock among transform kernel candidates.
 5. The image decoding method ofclaim 4, wherein the transform kernel index flag is included in theLFNST index information based on the LFNST flag representing that thenon-separable transform is applied and the MIP flag representing thatthe MIP is not applied.
 6. The image decoding method of claim 4, whereinthe LFNST flag and the transform kernel index flag are derived throughfixed length (FL) based binarization.
 7. The image decoding method ofclaim 6, wherein a first bin of a bin string of the LFNST flag isderived based on context coding, the context coding is performed basedon a context index increment value for the LFNST flag, and the contextindex increment value is derived as one of candidates including 0 and 1,and wherein a first bin of a bin string of the transform kernel indexflag is derived based on bypass coding.
 8. The image decoding method ofclaim 7, wherein the context index increment value is derived based on amultiple transform selection (MTS) index representing a transform kernelset to be used for the current block among transform kernel sets, andtree type information representing a partitioning structure of thecurrent block.
 9. The image decoding method of claim 4, wherein theresidual related information does not include the LFNST indexinformation and the transform kernel index flag based on the MIP flagrepresenting that the MIP is applied, and wherein the LFNST flag and thetransform kernel index flag are derived based on at least one ofreference line index information for the current block, intra predictionmode information of the current block, size information of the currentblock, or the MIP flag.
 10. An image encoding method performed by anencoding apparatus, the method comprising: determining an intraprediction type for a current block; generating intra prediction typeinformation for the current block based on the intra prediction type;deriving prediction samples of the current block based on the intraprediction type; generating residual samples of the current block basedon the prediction samples; deriving transform coefficients for thecurrent block based on the residual samples; generating residual relatedinformation based on the transform coefficients; and encoding the intraprediction type information and the residual related information,wherein the intra prediction type information includes a matrix basedintra prediction (MIP) flag representing whether MIP is applied to thecurrent block, wherein the residual related information includes lowfrequency non-separable transform (LFNST) index information representinginformation about non-separable transform of low-frequency transformcoefficients of the current block based on the MIP flag, wherein theLFNST index information is generated based on a transform kernel used toderive the transform coefficients, wherein a parsing order of the MIPflag is prior to a parsing order of the LFNST index information, whereinbased on a value of the MIP flag being not equal to 1, the residualrelated information includes the LFNST index information, and whereinthe LFNST index information is configured in a coding unit syntax basedon the MIP flag.
 11. The image decoding method of claim 1, wherein theresidual related information includes the LFNST index informationfurther based on an LFNST enabled flag representing that an LFNST isenabled, and wherein the LFNST index information is configured in thecoding unit syntax further based on the LFNST enabled flag.
 12. Theimage decoding method of claim 1, wherein the residual relatedinformation includes the LFNST index information further based on aminimum value among a width and a height of the current block beingequal to or greater than 4, and wherein the LFNST index information isconfigured in the coding unit syntax further based on the minimum value.13. A non-transitory computer-readable storage medium storing abitstream generated by an encoding method, the method comprising:determining an intra prediction type for a current block; generatingintra prediction type information for the current block based on theintra prediction type; deriving prediction samples of the current blockbased on the intra prediction type; generating residual samples of thecurrent block based on the prediction samples; deriving transformcoefficients for the current block based on the residual samples;generating residual related information based on the transformcoefficients; and encoding the intra prediction type information and theresidual related information, wherein the intra prediction typeinformation includes a matrix based intra prediction (MIP) flagrepresenting whether MIP is applied to the current block, wherein theresidual related information includes low frequency non-separabletransform (LFNST) index information for the current block based on theMIP flag, wherein the LFNST index information is generated based on atransform kernel used to derive the transform coefficients, wherein aparsing order of the MIP flag is prior to a parsing order of the LFNSTindex information, wherein based on a value of the MIP flag being notequal to 1, the residual related information includes the LFNST indexinformation, and wherein the LFNST index information is configured in acoding unit syntax based on the MIP flag.
 14. A transmission method ofdata for an image, the method comprising: obtaining a bitstream for theimage, the bitstream is generated by performing determining an intraprediction type for a current block, generating intra prediction typeinformation for the current block based on the intra prediction type,deriving prediction samples of the current block based on the intraprediction type, generating residual samples of the current block basedon the prediction samples, deriving transform coefficients for thecurrent block based on the residual samples, generating residual relatedinformation based on the transform coefficients, and encoding the intraprediction type information and the residual related information togenerate the bitstream; and transmitting the data comprising thebitstream, wherein the intra prediction type information includes amatrix based intra prediction (MIP) flag representing whether MIP isapplied to the current block, wherein the residual related informationincludes low frequency non-separable transform (LFNST) index informationfor the current block based on the MIP flag, wherein the LFNST indexinformation is generated based on a transform kernel used to derive thetransform coefficients, wherein a parsing order of the MIP flag is priorto a parsing order of the LFNST index information, wherein based on avalue of the MIP flag being not equal to 1, the residual relatedinformation includes the LFNST index information, and wherein the LFNSTindex information is configured in a coding unit syntax based on the MIPflag.
 15. The image decoding method of claim 1, wherein the intraprediction type information further includes intra sub-partitions (ISP)related information about sub-partitioning of the current block, andwherein the residual related information includes the LFNST indexinformation based on the MIP flag and the ISP related information.